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

mod_assign: Editing grades for previous submission attempts overwrites existing grades

    XMLWordPrintable

    Details

    • Testing Instructions:
      Hide
      1. Create an assignment and set the following "Submission settings > Attempts reopened - Manually".
      2. Log in as a student and submit something.
      3. Log in as a teacher and grade the student. Leave the grade empty and just provide some feedback.
      4. At the bottom of the grading pane there should be an option "Allow another attempt" - Set this to "Yes".
      5. Click save.
      6. Log in as a student and make another submission.
      7. Log in as the teacher and grade the new submission. Add a grade and some feedback.
      8. Scroll down the grading pane and select the first attempt.
      9. Fill in the grade for the first attempt.
      10. Check that the second attempt has not been overridden. And that the feedback is different for each attempt. The current grade in the grade book should be the second (last) attempt.
      11. If this test was too short you could try multiple attempts and changing grades / feedback in each of them.
      Show
      Create an assignment and set the following "Submission settings > Attempts reopened - Manually". Log in as a student and submit something. Log in as a teacher and grade the student. Leave the grade empty and just provide some feedback. At the bottom of the grading pane there should be an option "Allow another attempt" - Set this to "Yes". Click save. Log in as a student and make another submission. Log in as the teacher and grade the new submission. Add a grade and some feedback. Scroll down the grading pane and select the first attempt. Fill in the grade for the first attempt. Check that the second attempt has not been overridden. And that the feedback is different for each attempt. The current grade in the grade book should be the second (last) attempt. If this test was too short you could try multiple attempts and changing grades / feedback in each of them.
    • Affected Branches:
      MOODLE_29_STABLE, MOODLE_30_STABLE, MOODLE_31_STABLE, MOODLE_32_STABLE
    • Fixed Branches:
      MOODLE_30_STABLE, MOODLE_31_STABLE
    • Pull from Repository:
    • Pull Master Branch:
      wip-MDL-55505-master

      Description

      Steps to replicate (as described by our client):

      • Student submits assignment for marking.
      • Trainer adds feedback to attempt, but, forgets to add a grade. Reopens assignment for student to submit a second attempt.
      • Student submits second attempt.
      • Trainer grades second attempt 100 out of 100 and adds feedback to student to say they have passed.
      • Trainer notices that the first attempt does not have a grade so edits the first attempt and adds the missing grade of 50 out of 100.
      • ISSUE – Second attempt grade now has changed to 50 out of 100 and feedback from first attempt has overwritten second. Essentially the grade and feedback on the second attempt is lost and replaced with the data just added to attempt one.
      • ISSUE – Attempt one still has no grade and same feedback as the data gets written to attempt two. No way to edit or change attempt one and second attempt data is lost.

      I was able to track the issue down and apply a following patch, which helped.

      --- a/mod/assign/locallib.php
      +++ b/mod/assign/locallib.php
      @@ -6719,7 +6719,7 @@ class assign {
           protected function apply_grade_to_user($formdata, $userid, $attemptnumber) {
               global $USER, $CFG, $DB;
       
      -        $grade = $this->get_user_grade($userid, true, $attemptnumber);
      +        $grade = $this->get_user_grade($userid, ($formdata->attemptnumber == -1), $attemptnumber);
               $originalgrade = $grade->grade;
               $gradingdisabled = $this->grading_disabled($userid);
               $gradinginstance = $this->get_grading_instance($userid, $grade, $gradingdisabled);
      

        Attachments

          Activity

            People

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

              Dates

              • Created:
                Updated:
                Resolved:
                Fix Release Date:
                14/Nov/16