Moodle
  1. Moodle
  2. MDL-32909

Un-overriding a grade causes an error

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 2.3
    • Fix Version/s: 2.3
    • Component/s: Assignment
    • Labels:
    • Testing Instructions:
      Hide
      1. Create an instance of the new assignment module in a course with at least one student
      2. Go to the grading report and override a students mark for the assignment
      3. Edit the mark again and uncheck the overridden option
      4. Mark should go back to the mark from the assignment (none in this case). Without this patch you will see the above error at this step.
      Show
      Create an instance of the new assignment module in a course with at least one student Go to the grading report and override a students mark for the assignment Edit the mark again and uncheck the overridden option Mark should go back to the mark from the assignment (none in this case). Without this patch you will see the above error at this step.
    • Affected Branches:
      MOODLE_23_STABLE
    • Fixed Branches:
      MOODLE_23_STABLE
    • Pull Master Branch:
    • Rank:
      39989

      Description

      After overriding a grade, then unchecking the override option to restore the original grade, an error was displayed...

      Can not find data record in database table course_modules.
      
      More information about this error
      Debug info: SELECT id,course FROM {course_modules} WHERE id = ?
      [array (
      0 => '',
      )]
      Stack trace:
      
          line 1316 of \lib\dml\moodle_database.php: dml_missing_record_exception thrown
          line 1292 of \lib\dml\moodle_database.php: call to moodle_database->get_record_select()
          line 6585 of \lib\accesslib.php: call to moodle_database->get_record()
          line 757 of \mod\assign\lib.php: call to context_module::instance()
          line 776 of \mod\assign\lib.php: call to assign_get_user_grades()
          line 1190 of \lib\gradelib.php: call to assign_update_grades()
          line 1447 of \lib\grade\grade_item.php: call to grade_update_mod_grades()
          line 319 of \lib\grade\grade_grade.php: call to grade_item->refresh_grades()
          line 215 of \grade\edit\tree\grade.php: call to grade_grade->set_overridden()
      

      This did not happen when I did the same think with the older assignment module.

      Replication steps:

      1. Create an assignment
      2. Go to the assignment grading page and grade some students (no need for submissions)
      3. Go to the Grading report (Course admin -> Grades)
      4. Turn editing on
      5. Click the edit icon (in Standard theme this is a hand holding a pencil)
      6. Check the overridden checkbox setting, alter the grade and save
      7. Click the edit icon again
      8. Uncheck the overridden checkbox and save

      Expected result: the user should be returned to the Grader report and the original grade should be shown

      Actual result: an error is shown

        Issue Links

          Activity

          Hide
          Damyon Wiese added a comment -

          Rebased to latest weekly dev.

          Show
          Damyon Wiese added a comment - Rebased to latest weekly dev.
          Hide
          Dan Poltawski added a comment -

          Thanks Damyon, taking this straight into integration

          Show
          Dan Poltawski added a comment - Thanks Damyon, taking this straight into integration
          Hide
          Dan Poltawski added a comment -

          Thanks, i've integrated this now

          Show
          Dan Poltawski added a comment - Thanks, i've integrated this now
          Hide
          Andrew Davis added a comment -

          Tested fine in master. Passing.

          Show
          Andrew Davis added a comment - Tested fine in master. Passing.
          Hide
          Eloy Lafuente (stronk7) added a comment -

          U P S T R E A M I Z E D !

          Many thanks for the hard work, closing this as fixed.

          Ciao

          Show
          Eloy Lafuente (stronk7) added a comment - U P S T R E A M I Z E D ! Many thanks for the hard work, closing this as fixed. Ciao

            People

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

              Dates

              • Created:
                Updated:
                Resolved: