Moodle
  1. Moodle
  2. MDL-35004

Can not create a new instance of the assignment module with no completion setting

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 2.4
    • Fix Version/s: 2.4
    • Component/s: Assignment
    • Labels:
    • Rank:
      43603

      Description

      Can not create a new instance of the assignment module with no completion setting

      Debug info: ERROR: null value in column "completionsubmit" violates not-null constraint
      INSERT INTO mdl_assign (name,timemodified,course,intro,introformat,alwaysshowdescription,preventlatesubmissions,submissiondrafts,requiresubmissionstatement,sendnotifications,sendlatenotifications,duedate,allowsubmissionsfromdate,grade,completionsubmit) VALUES($1,$2,$3,$4,$5,$6,$7,$8,$9,$10,$11,$12,$13,$14,$15) RETURNING id
      [array (
      'name' => 'new assignment',
      'timemodified' => 1345608855,
      'course' => '3',
      'intro' => '<p>ttttttttt</p>',
      'introformat' => '1',
      'alwaysshowdescription' => '1',
      'preventlatesubmissions' => '0',
      'submissiondrafts' => '0',
      'requiresubmissionstatement' => '1',
      'sendnotifications' => '0',
      'sendlatenotifications' => '0',
      'duedate' => 1346213400,
      'allowsubmissionsfromdate' => 1345608600,
      'grade' => '100',
      'completionsubmit' => NULL,
      )]
      Error code: dmlwriteexception
      Stack trace:
      
          line 410 of /lib/dml/moodle_database.php: dml_write_exception thrown
          line 239 of /lib/dml/pgsql_native_moodle_database.php: call to moodle_database->query_end()
          line 819 of /lib/dml/pgsql_native_moodle_database.php: call to pgsql_native_moodle_database->query_end()
          line 871 of /lib/dml/pgsql_native_moodle_database.php: call to pgsql_native_moodle_database->insert_record_raw()
          line 421 of /mod/assign/locallib.php: call to pgsql_native_moodle_database->insert_record()
          line 39 of /mod/assign/lib.php: call to assign->add_instance()
          line 447 of /course/modedit.php: call to assign_add_instance()
      
      Output buffer: Notice: Undefined property: stdClass::$completionsubmit in /home/raymond/moodle/mod/assign/locallib.php on line 420 
      

        Issue Links

          Activity

          Hide
          Raymond Antonio added a comment -

          Hi Damyon,

          This is a patch for this bug and it sits on my github repo : MDL-35004
          https://github.com/raymondAntonio/moodle/tree/MDL-35004

          and here is the diff:

          https://github.com/raymondAntonio/moodle/commit/6b48ec97979d4106ea8db9803707c8585f493995

          Cheers

          Show
          Raymond Antonio added a comment - Hi Damyon, This is a patch for this bug and it sits on my github repo : MDL-35004 https://github.com/raymondAntonio/moodle/tree/MDL-35004 and here is the diff: https://github.com/raymondAntonio/moodle/commit/6b48ec97979d4106ea8db9803707c8585f493995 Cheers
          Hide
          Damyon Wiese added a comment -

          Looks good to me.

          Show
          Damyon Wiese added a comment - Looks good to me.
          Hide
          Eloy Lafuente (stronk7) added a comment -

          The main moodle.git repository has just been updated with latest weekly modifications. You may wish to rebase your PULL branches to simplify history and avoid any possible merge conflicts. This would also make integrator's life easier next week.

          TIA and ciao

          Show
          Eloy Lafuente (stronk7) added a comment - The main moodle.git repository has just been updated with latest weekly modifications. You may wish to rebase your PULL branches to simplify history and avoid any possible merge conflicts. This would also make integrator's life easier next week. TIA and ciao
          Hide
          Raymond Antonio added a comment -

          Hi Eloy,

          Thanks for your suggestion and I just did the rebase my PULL branches to make integrator's life less tough and here is the new diff:

          https://github.com/raymondAntonio/moodle/commit/694b11ab4a0a5c91e8b8c9bbb83623b56db82503

          Cheers

          Show
          Raymond Antonio added a comment - Hi Eloy, Thanks for your suggestion and I just did the rebase my PULL branches to make integrator's life less tough and here is the new diff: https://github.com/raymondAntonio/moodle/commit/694b11ab4a0a5c91e8b8c9bbb83623b56db82503 Cheers
          Hide
          Aparup Banerjee added a comment -

          integrated this into master only.

          ps: not sure why affects 2.3.x ? does it ? patch doesn't apply there and i can't find any 'completion' there for 2.3.x

          Show
          Aparup Banerjee added a comment - integrated this into master only. ps: not sure why affects 2.3.x ? does it ? patch doesn't apply there and i can't find any 'completion' there for 2.3.x
          Hide
          Eloy Lafuente (stronk7) added a comment -

          Yeah, this is only for master, I arrived here while testing other issues.

          Also... and that's my biggest concern, it seems to happen no matter if you've completion enabled or no. So I'm guessing when this fix, that simply prevents the error to happen, is enough, or we have some problem where completion is not being handled properly.

          I really would recommend to re-test MDL-31341 and ensure "completionsubmit" is being handled/set properly under all combinations.

          For your consideration, perhaps one followup task (testing only with special care to that column) could be an acceptable idea.

          Ciao

          Show
          Eloy Lafuente (stronk7) added a comment - Yeah, this is only for master, I arrived here while testing other issues. Also... and that's my biggest concern, it seems to happen no matter if you've completion enabled or no. So I'm guessing when this fix, that simply prevents the error to happen, is enough, or we have some problem where completion is not being handled properly. I really would recommend to re-test MDL-31341 and ensure "completionsubmit" is being handled/set properly under all combinations. For your consideration, perhaps one followup task (testing only with special care to that column) could be an acceptable idea. Ciao
          Hide
          David Monllaó added a comment -

          Tested only in master, with completion tracking...

          • Disabled at system level
          • Enabled at system level and disabled at course level
          • Enabled at system and course level

          MDL-31341 also tested in master without problems

          Show
          David Monllaó added a comment - Tested only in master, with completion tracking... Disabled at system level Enabled at system level and disabled at course level Enabled at system and course level MDL-31341 also tested in master without problems
          Hide
          Eloy Lafuente (stronk7) added a comment -

          I'm so proud...of you, many thanks!

          http://youtu.be/n64CdfDRnZY

          Closing as fixed, ciao

          Show
          Eloy Lafuente (stronk7) added a comment - I'm so proud...of you, many thanks! http://youtu.be/n64CdfDRnZY Closing as fixed, ciao

            People

            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: