Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-37621

Use MDL-37459 to add admin defaults for assignment module.

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 2.5
    • Fix Version/s: 2.6
    • Component/s: Assignment
    • Labels:
    • Testing Instructions:
      Hide
      1. Exploratory testing of the new admin settings is required to see their affect on the settings screen of the assignment
      2. For each setting in /admin/settings.php?section=modsettingassign
        1. Change the default, advanced, locked and enabled flags (if available)
        2. After each change view the create new assignment page and verify that the change in the admin setting has changed the assignment creation form in an expected way.
        3. The expectations are that:
        4. Locking a setting will make it readonly
        5. Changing a default will affect the default value of that setting for new assignments (dates will be relative to midnight)
        6. Making a setting advanced will hide it behind a "Show more" link in the form
      Show
      Exploratory testing of the new admin settings is required to see their affect on the settings screen of the assignment For each setting in /admin/settings.php?section=modsettingassign Change the default, advanced, locked and enabled flags (if available) After each change view the create new assignment page and verify that the change in the admin setting has changed the assignment creation form in an expected way. The expectations are that: Locking a setting will make it readonly Changing a default will affect the default value of that setting for new assignments (dates will be relative to midnight) Making a setting advanced will hide it behind a "Show more" link in the form
    • Affected Branches:
      MOODLE_25_STABLE
    • Fixed Branches:
      MOODLE_26_STABLE
    • Pull from Repository:
    • Pull Master Branch:
      MDL-37621-master

      Description

      Add admin defaults for each of the settings in the assignment module.

        Gliffy Diagrams

          Issue Links

            Activity

            Hide
            damyon Damyon Wiese added a comment -

            This is more of a demonstration of how to apply admin defaults.

            Show
            damyon Damyon Wiese added a comment - This is more of a demonstration of how to apply admin defaults.
            Hide
            damyon Damyon Wiese added a comment -

            This issue was assigned to me automatically, however I will not be able to work on this issue in the immediate future. In order to create a truer sense of the state of this issue and to allow other developers to have chance to become involved, I am removing myself as the assignee of this issue.

            For more information, see http://docs.moodle.org/dev/Changes_to_issue_assignment

            Show
            damyon Damyon Wiese added a comment - This issue was assigned to me automatically, however I will not be able to work on this issue in the immediate future. In order to create a truer sense of the state of this issue and to allow other developers to have chance to become involved, I am removing myself as the assignee of this issue. For more information, see http://docs.moodle.org/dev/Changes_to_issue_assignment
            Hide
            marina Marina Glancy added a comment -

            Hi Damyon,
            looks very good. Can you please increase the version number (because of all new settings) and add AMOS tag in the commit message. Thanks

            Show
            marina Marina Glancy added a comment - Hi Damyon, looks very good. Can you please increase the version number (because of all new settings) and add AMOS tag in the commit message. Thanks
            Hide
            damyon Damyon Wiese added a comment -

            Hi Marina,

            I bumped the version, added the AMOS and rebased ontop of the changes in MDL-37459.

            Thanks!

            Show
            damyon Damyon Wiese added a comment - Hi Marina, I bumped the version, added the AMOS and rebased ontop of the changes in MDL-37459 . Thanks!
            Hide
            damyon Damyon Wiese added a comment -

            Thinking - there may be a conflict with MDL-37490.

            I'll check this and rebase now...

            Show
            damyon Damyon Wiese added a comment - Thinking - there may be a conflict with MDL-37490 . I'll check this and rebase now...
            Hide
            damyon Damyon Wiese added a comment -

            MDL-37490 was reverted so no conflict. Rebased and reran unit tests.

            Show
            damyon Damyon Wiese added a comment - MDL-37490 was reverted so no conflict. Rebased and reran unit tests.
            Hide
            marina Marina Glancy added a comment -

            Thanks Damyon, this has been integrated

            Show
            marina Marina Glancy added a comment - Thanks Damyon, this has been integrated
            Hide
            damyon Damyon Wiese added a comment -

            I found a problem with this patch - it gives an error when creating a new assignment with no teamsubmissiongroupingid. I removed one too many defaults when I went through the form.

            Marina can you pull in this extra fix please?

            https://github.com/damyon/moodle/commit/3b7eace3c809889fd3993691bd12645175bf5dbc

            Thankyou!

            Show
            damyon Damyon Wiese added a comment - I found a problem with this patch - it gives an error when creating a new assignment with no teamsubmissiongroupingid. I removed one too many defaults when I went through the form. Marina can you pull in this extra fix please? https://github.com/damyon/moodle/commit/3b7eace3c809889fd3993691bd12645175bf5dbc Thankyou!
            Hide
            marina Marina Glancy added a comment -

            done

            Show
            marina Marina Glancy added a comment - done
            Hide
            skodak Petr Skoda added a comment - - edited

            1/ the date locking does not seem to work in the edit form - see screenshot
            2/ I am confused about the "locked" flag - I expected it would keep the things the way they are, but it seems to "force" the setting instead during the next save
            3/ the "Require that students accept the submission statement -assign | requiresubmissionstatement" should be converted too, right?
            4/ "Grouping for student groups" can not be made advanced, everything else can it seems

            Show
            skodak Petr Skoda added a comment - - edited 1/ the date locking does not seem to work in the edit form - see screenshot 2/ I am confused about the "locked" flag - I expected it would keep the things the way they are, but it seems to "force" the setting instead during the next save 3/ the "Require that students accept the submission statement -assign | requiresubmissionstatement" should be converted too, right? 4/ "Grouping for student groups" can not be made advanced, everything else can it seems
            Hide
            damyon Damyon Wiese added a comment -

            Thanks Petr - I have pushed a branch with 2 extra commits to fix these issues.

            Specifically:
            1/ This patch removes date locking as this does not make sense (needs to go in the docs)
            2/ The behaviour of the locked flag has changed in the fix for MDL-37459 and should now make sense (once the fix is integrated)
            3/ This setting already had a default - I added to this patch to change from the old behaviour to the new behaviour (and changed the help strings accordingly)
            4/ I added a new admin setting type to deal with this adminsetting_configempty - so you can add flags even when it does not make sense for a setting to have a default.

            The new branch is https://github.com/damyon/moodle/tree/MDL-37621-master-fix2 and is based on https://github.com/damyon/moodle/tree/MDL-37459-master-fix2

            So the diff is:
            https://github.com/damyon/moodle/compare/MDL-37459-master-fix2...MDL-37621-master-fix2

            Show
            damyon Damyon Wiese added a comment - Thanks Petr - I have pushed a branch with 2 extra commits to fix these issues. Specifically: 1/ This patch removes date locking as this does not make sense (needs to go in the docs) 2/ The behaviour of the locked flag has changed in the fix for MDL-37459 and should now make sense (once the fix is integrated) 3/ This setting already had a default - I added to this patch to change from the old behaviour to the new behaviour (and changed the help strings accordingly) 4/ I added a new admin setting type to deal with this adminsetting_configempty - so you can add flags even when it does not make sense for a setting to have a default. The new branch is https://github.com/damyon/moodle/tree/MDL-37621-master-fix2 and is based on https://github.com/damyon/moodle/tree/MDL-37459-master-fix2 So the diff is: https://github.com/damyon/moodle/compare/MDL-37459-master-fix2...MDL-37621-master-fix2
            Hide
            skodak Petr Skoda added a comment -

            thanks

            Show
            skodak Petr Skoda added a comment - thanks
            Hide
            marina Marina Glancy added a comment -

            patch integrated in master, thanks Damyon.
            Ready for re-testing

            Show
            marina Marina Glancy added a comment - patch integrated in master, thanks Damyon. Ready for re-testing
            Hide
            skodak Petr Skoda added a comment -

            I suppose this string: If enabled, students will have to click a Submit button to declare their submission as final. This allows students to keep a draft version of the submission on the system. If this setting is changed from "No" to "Yes" after students have already submitted those submissions will be regarded as final.

            is not correct any more - the change from no --> yes, right?

            Show
            skodak Petr Skoda added a comment - I suppose this string: If enabled, students will have to click a Submit button to declare their submission as final. This allows students to keep a draft version of the submission on the system. If this setting is changed from "No" to "Yes" after students have already submitted those submissions will be regarded as final. is not correct any more - the change from no --> yes, right?
            Hide
            damyon Damyon Wiese added a comment -

            No - that help text still sounds correct to me - we didn't change the way that setting works at all.

            E.g.

            (stage one - Require students click submit button - No)

            Student uploads file

            file goes straight to the "submitted" state because they do not have to click submit

            (stage two - Require students click submit button changed to Yes)

            Those previous submissions are still in the "submitted" state

            Any new submissions will go to the "draft" state

            Show
            damyon Damyon Wiese added a comment - No - that help text still sounds correct to me - we didn't change the way that setting works at all. E.g. (stage one - Require students click submit button - No) Student uploads file file goes straight to the "submitted" state because they do not have to click submit (stage two - Require students click submit button changed to Yes) Those previous submissions are still in the "submitted" state Any new submissions will go to the "draft" state
            Hide
            skodak Petr Skoda added a comment -

            oh, right, I was reading it incorrectly

            Show
            skodak Petr Skoda added a comment - oh, right, I was reading it incorrectly
            Hide
            skodak Petr Skoda added a comment -

            hmm, I have tried to flip this back to testing, but it seems the workflow was changed and I can not do that any more

            Marina: could you please send it back to testing?

            Show
            skodak Petr Skoda added a comment - hmm, I have tried to flip this back to testing, but it seems the workflow was changed and I can not do that any more Marina: could you please send it back to testing?
            Hide
            marina Marina Glancy added a comment -

            sure, here you are

            Show
            marina Marina Glancy added a comment - sure, here you are
            Hide
            damyon Damyon Wiese added a comment -

            Hi Marina,

            Can you please pull in one more fix for this issue? I managed to get a DB error on update when the teamsubmissiongroupingid was disabled because teamsubmissions was off (and locked).

            Branch: MDL-37459-master-fix3
            Diff: https://github.com/damyon/moodle/compare/19c1e0b80a9156d84f9b579dba22fd305d7e6cfb...MDL-37459-master-fix3

            Thanks, Damyon

            Show
            damyon Damyon Wiese added a comment - Hi Marina, Can you please pull in one more fix for this issue? I managed to get a DB error on update when the teamsubmissiongroupingid was disabled because teamsubmissions was off (and locked). Branch: MDL-37459 -master-fix3 Diff: https://github.com/damyon/moodle/compare/19c1e0b80a9156d84f9b579dba22fd305d7e6cfb...MDL-37459-master-fix3 Thanks, Damyon
            Hide
            marina Marina Glancy added a comment -

            done

            Show
            marina Marina Glancy added a comment - done
            Hide
            dmonllao David Monllaó added a comment -

            Error detected by behat tests both before and after pulling the latest integration version including this last MDL-37459-master-fix3 patch

            Displayed when creating an assignment instance in a clean site

            Error writing to database
            Debug info: ERROR: null value in column "teamsubmissiongroupingid" violates not-null constraint
            INSERT INTO cccc_assign (name,timemodified,course,intro,introformat,alwaysshowdescription,submissiondrafts,requiresubmissionstatement,sendnotifications,sendlatenotifications,duedate,cutoffdate,allowsubmissionsfromdate,grade,completionsubmit,teamsubmission,requireallteammemberssubmit,teamsubmissiongroupingid,blindmarking,attemptreopenmethod,maxattempts,markingworkflow,markingallocation) VALUES($1,$2,$3,$4,$5,$6,$7,$8,$9,$10,$11,$12,$13,$14,$15,$16,$17,$18,$19,$20,$21,$22,$23) RETURNING id
            [array (
            'name' => 'zxcv',
            'timemodified' => 1371090579,
            'course' => '2',
            'intro' => '<p>zxcv</p>',
            'introformat' => '1',
            'alwaysshowdescription' => 0,
            'submissiondrafts' => '0',
            'requiresubmissionstatement' => '0',
            'sendnotifications' => '0',
            'sendlatenotifications' => '0',
            'duedate' => 0,
            'cutoffdate' => 0,
            'allowsubmissionsfromdate' => 0,
            'grade' => '100',
            'completionsubmit' => 0,
            'teamsubmission' => '0',
            'requireallteammemberssubmit' => '0',
            'teamsubmissiongroupingid' => NULL,
            'blindmarking' => '0',
            'attemptreopenmethod' => 'none',
            'maxattempts' => '-1',
            'markingworkflow' => '0',
            'markingallocation' => '0',
            )]
            Error code: dmlwriteexception
            Stack trace:
            line 426 of /lib/dml/moodle_database.php: dml_write_exception thrown
            line 248 of /lib/dml/pgsql_native_moodle_database.php: call to moodle_database->query_end()
            line 857 of /lib/dml/pgsql_native_moodle_database.php: call to pgsql_native_moodle_database->query_end()
            line 909 of /lib/dml/pgsql_native_moodle_database.php: call to pgsql_native_moodle_database->insert_record_raw()
            line 569 of /mod/assign/locallib.php: call to pgsql_native_moodle_database->insert_record()
            line 40 of /mod/assign/lib.php: call to assign->add_instance()
            line 98 of /course/modlib.php: call to assign_add_instance()
            line 262 of /course/modedit.php: call to add_moduleinfo()
            Output buffer: <br /> <font size='1'><table class='xdebug-error xe-notice' dir='ltr' border='1' cellspacing='0' cellpadding='1'> <tr><th align='left' bgcolor='#f57900' colspan="5"><span style='background-color: #cc0000; color: #fce94f; font-size: x-large;'>( ! )</span> Notice: Undefined property: stdClass::$teamsubmissiongroupingid in /home/davidm/Desktop/moodlecode/INTEGRATION/master/mod/assign/locallib.php on line <i>557</i></th></tr> <tr><th align='left' bgcolor='#e9b96e' colspan='5'>Call Stack</th></tr> <tr><th align='center' bgcolor='#eeeeec'>#</th><th align='left' bgcolor='#eeeeec'>Time</th><th align='left' bgcolor='#eeeeec'>Memory</th><th align='left' bgcolor='#eeeeec'>Function</th><th align='left' bgcolor='#eeeeec'>Location</th></tr> <tr><td bgcolor='#eeeeec' align='center'>1</td><td bgcolor='#eeeeec' align='center'>0.0007</td><td bgcolor='#eeeeec' align='right'>343800</td><td bgcolor='#eeeeec'>{main}( )</td><td title='/home/davidm/Desktop/moodlecode/INTEGRATION/master/course/modedit.php' bgcolor='#eeeeec'>../modedit.php<b>:</b>0</td></tr> <tr><td bgcolor='#eeeeec' align='center'>2</td><td bgcolor='#eeeeec' align='center'>0.3401</td><td bgcolor='#eeeeec' align='right'>31670104</td><td bgcolor='#eeeeec'>add_moduleinfo( )</td><td title='/home/davidm/Desktop/moodlecode/INTEGRATION/master/course/modedit.php' bgcolor='#eeeeec'>../modedit.php<b>:</b>262</td></tr> <tr><td bgcolor='#eeeeec' align='center'>3</td><td bgcolor='#eeeeec' align='center'>0.3622</td><td bgcolor='#eeeeec' align='right'>31700736</td><td bgcolor='#eeeeec'>assign_add_instance( )</td><td title='/home/davidm/Desktop/moodlecode/INTEGRATION/master/course/modlib.php' bgcolor='#eeeeec'>../modlib.php<b>:</b>98</td></tr> <tr><td bgcolor='#eeeeec' align='center'>4</td><td bgcolor='#eeeeec' align='center'>0.3798</td><td bgcolor='#eeeeec' align='right'>31705136</td><td bgcolor='#eeeeec'>assign->add_instance( )</td><td title='/home/davidm/Desktop/moodlecode/INTEGRATION/master/mod/assign/lib.php' bgcolor='#eeeeec'>../lib.php<b>:</b>40</td></tr> </table></font>

            Show
            dmonllao David Monllaó added a comment - Error detected by behat tests both before and after pulling the latest integration version including this last MDL-37459 -master-fix3 patch Displayed when creating an assignment instance in a clean site Error writing to database Debug info: ERROR: null value in column "teamsubmissiongroupingid" violates not-null constraint INSERT INTO cccc_assign (name,timemodified,course,intro,introformat,alwaysshowdescription,submissiondrafts,requiresubmissionstatement,sendnotifications,sendlatenotifications,duedate,cutoffdate,allowsubmissionsfromdate,grade,completionsubmit,teamsubmission,requireallteammemberssubmit,teamsubmissiongroupingid,blindmarking,attemptreopenmethod,maxattempts,markingworkflow,markingallocation) VALUES($1,$2,$3,$4,$5,$6,$7,$8,$9,$10,$11,$12,$13,$14,$15,$16,$17,$18,$19,$20,$21,$22,$23) RETURNING id [array ( 'name' => 'zxcv', 'timemodified' => 1371090579, 'course' => '2', 'intro' => '<p>zxcv</p>', 'introformat' => '1', 'alwaysshowdescription' => 0, 'submissiondrafts' => '0', 'requiresubmissionstatement' => '0', 'sendnotifications' => '0', 'sendlatenotifications' => '0', 'duedate' => 0, 'cutoffdate' => 0, 'allowsubmissionsfromdate' => 0, 'grade' => '100', 'completionsubmit' => 0, 'teamsubmission' => '0', 'requireallteammemberssubmit' => '0', 'teamsubmissiongroupingid' => NULL, 'blindmarking' => '0', 'attemptreopenmethod' => 'none', 'maxattempts' => '-1', 'markingworkflow' => '0', 'markingallocation' => '0', )] Error code: dmlwriteexception Stack trace: line 426 of /lib/dml/moodle_database.php: dml_write_exception thrown line 248 of /lib/dml/pgsql_native_moodle_database.php: call to moodle_database->query_end() line 857 of /lib/dml/pgsql_native_moodle_database.php: call to pgsql_native_moodle_database->query_end() line 909 of /lib/dml/pgsql_native_moodle_database.php: call to pgsql_native_moodle_database->insert_record_raw() line 569 of /mod/assign/locallib.php: call to pgsql_native_moodle_database->insert_record() line 40 of /mod/assign/lib.php: call to assign->add_instance() line 98 of /course/modlib.php: call to assign_add_instance() line 262 of /course/modedit.php: call to add_moduleinfo() Output buffer: <br /> <font size='1'><table class='xdebug-error xe-notice' dir='ltr' border='1' cellspacing='0' cellpadding='1'> <tr><th align='left' bgcolor='#f57900' colspan="5"><span style='background-color: #cc0000; color: #fce94f; font-size: x-large;'>( ! )</span> Notice: Undefined property: stdClass::$teamsubmissiongroupingid in /home/davidm/Desktop/moodlecode/INTEGRATION/master/mod/assign/locallib.php on line <i>557</i></th></tr> <tr><th align='left' bgcolor='#e9b96e' colspan='5'>Call Stack</th></tr> <tr><th align='center' bgcolor='#eeeeec'>#</th><th align='left' bgcolor='#eeeeec'>Time</th><th align='left' bgcolor='#eeeeec'>Memory</th><th align='left' bgcolor='#eeeeec'>Function</th><th align='left' bgcolor='#eeeeec'>Location</th></tr> <tr><td bgcolor='#eeeeec' align='center'>1</td><td bgcolor='#eeeeec' align='center'>0.0007</td><td bgcolor='#eeeeec' align='right'>343800</td><td bgcolor='#eeeeec'>{main}( )</td><td title='/home/davidm/Desktop/moodlecode/INTEGRATION/master/course/modedit.php' bgcolor='#eeeeec'>../modedit.php<b>:</b>0</td></tr> <tr><td bgcolor='#eeeeec' align='center'>2</td><td bgcolor='#eeeeec' align='center'>0.3401</td><td bgcolor='#eeeeec' align='right'>31670104</td><td bgcolor='#eeeeec'>add_moduleinfo( )</td><td title='/home/davidm/Desktop/moodlecode/INTEGRATION/master/course/modedit.php' bgcolor='#eeeeec'>../modedit.php<b>:</b>262</td></tr> <tr><td bgcolor='#eeeeec' align='center'>3</td><td bgcolor='#eeeeec' align='center'>0.3622</td><td bgcolor='#eeeeec' align='right'>31700736</td><td bgcolor='#eeeeec'>assign_add_instance( )</td><td title='/home/davidm/Desktop/moodlecode/INTEGRATION/master/course/modlib.php' bgcolor='#eeeeec'>../modlib.php<b>:</b>98</td></tr> <tr><td bgcolor='#eeeeec' align='center'>4</td><td bgcolor='#eeeeec' align='center'>0.3798</td><td bgcolor='#eeeeec' align='right'>31705136</td><td bgcolor='#eeeeec'>assign->add_instance( )</td><td title='/home/davidm/Desktop/moodlecode/INTEGRATION/master/mod/assign/lib.php' bgcolor='#eeeeec'>../lib.php<b>:</b>40</td></tr> </table></font>
            Hide
            marina Marina Glancy added a comment -

            this is such an unlucky issue...

            Show
            marina Marina Glancy added a comment - this is such an unlucky issue...
            Hide
            damyon Damyon Wiese added a comment -

            Hi Marina,

            I should not write comments at 11:16 at night - the branch I linked to in my comment was the wrong one (it was the fix for MDL-37459).

            https://github.com/damyon/moodle/commit/1e9e7f819a14c17a8d65629c598a71202c7cdecb

            Is the commit that fixes this issue (MDL-37621-master-fix3 is the branch).

            Show
            damyon Damyon Wiese added a comment - Hi Marina, I should not write comments at 11:16 at night - the branch I linked to in my comment was the wrong one (it was the fix for MDL-37459 ). https://github.com/damyon/moodle/commit/1e9e7f819a14c17a8d65629c598a71202c7cdecb Is the commit that fixes this issue ( MDL-37621 -master-fix3 is the branch).
            Hide
            dmonllao David Monllaó added a comment -

            Checked with Damyon, with this last patch integrated it succeeds

            Show
            dmonllao David Monllaó added a comment - Checked with Damyon, with this last patch integrated it succeeds
            Hide
            marina Marina Glancy added a comment -

            Damyon, no worries, I figured it out. But that's right, you should not be working at 11:16 at night and should be enjoying a family evening instead

            Show
            marina Marina Glancy added a comment - Damyon, no worries, I figured it out. But that's right, you should not be working at 11:16 at night and should be enjoying a family evening instead
            Hide
            skodak Petr Skoda added a comment -

            Everything seems to be working fine for me now, thanks!

            Show
            skodak Petr Skoda added a comment - Everything seems to be working fine for me now, thanks!
            Hide
            damyon Damyon Wiese added a comment -

            (Setting this to failed as it needs the last patch/testing).

            Show
            damyon Damyon Wiese added a comment - (Setting this to failed as it needs the last patch/testing).
            Hide
            poltawski Dan Poltawski added a comment -

            I've integrated the last patch

            Show
            poltawski Dan Poltawski added a comment - I've integrated the last patch
            Hide
            dmonllao David Monllaó added a comment -

            Confirming that no more database error with this last patch integrated, passing

            Show
            dmonllao David Monllaó added a comment - Confirming that no more database error with this last patch integrated, passing
            Hide
            marina Marina Glancy added a comment -

            Thanks for your awesome work! This has now become a part of Moodle.

            Closing as fixed!

            Show
            marina Marina Glancy added a comment - Thanks for your awesome work! This has now become a part of Moodle. Closing as fixed!
            Hide
            marycooch Mary Cooch added a comment -

            QA test here ready for inclusion in 2.6 testing MDLQA-5732.

            Show
            marycooch Mary Cooch added a comment - QA test here ready for inclusion in 2.6 testing MDLQA-5732 .
            Hide
            marycooch Mary Cooch added a comment -

            Removing docs_required label as this is now documented in http://docs.moodle.org/26/en/Assignment_settings

            Show
            marycooch Mary Cooch added a comment - Removing docs_required label as this is now documented in http://docs.moodle.org/26/en/Assignment_settings

              People

              • Votes:
                1 Vote for this issue
                Watchers:
                10 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Fix Release Date:
                  18/Nov/13