Moodle
  1. Moodle
  2. MDL-33464

Assignment Upgrade Helper causes duplication in the gradebook

    Details

    • Testing Instructions:
      Hide

      Steps to reproduce:

      1. Ensure both assignment versions are enabled and visible via site admin
      2. Create brand new empty course with some students
      3. Create 2 x v2.2 assignments of any type
      4. I added at least one grade for each assignment
      5. Run the Assignment Upgrade Helper. The two assignments you just created should be listed. Click 'Upgrade all'.
      6. Go to the course and verify that the assignments have been upgraded.
      7. Go to the course gradebook and see how many assignments appear for the course.

      Expected result.

      1. There should be 2 assignments in the gradebook
        Actual result
      2. There are 4 assignments in the gradebook
      Show
      Steps to reproduce: Ensure both assignment versions are enabled and visible via site admin Create brand new empty course with some students Create 2 x v2.2 assignments of any type I added at least one grade for each assignment Run the Assignment Upgrade Helper. The two assignments you just created should be listed. Click 'Upgrade all'. Go to the course and verify that the assignments have been upgraded. Go to the course gradebook and see how many assignments appear for the course. Expected result. There should be 2 assignments in the gradebook Actual result There are 4 assignments in the gradebook
    • Workaround:
      Hide

      If anyone needs some SQL to fix their install it would be possible (delete the second grade item from the database).

      Show
      If anyone needs some SQL to fix their install it would be possible (delete the second grade item from the database).
    • Affected Branches:
      MOODLE_23_STABLE
    • Fixed Branches:
      MOODLE_23_STABLE
    • Pull Master Branch:
    • Rank:
      41363

      Description

      Running the 'Assignment Upgrade Helper' to convert v2.2 assignments to v2.3 assignments causes the assignments to duplicate in the gradebook.

      The above is a simple test, but it did massive damage to a test upgrade of 24,000 assignments, including overstamping 'category' records with itemmodule='assign'.

        Issue Links

          Activity

          Hide
          Michael Woods added a comment -

          how mdl_grade_items (course=11262) looked before the upgrade of assignments

          Show
          Michael Woods added a comment - how mdl_grade_items (course=11262) looked before the upgrade of assignments
          Hide
          Michael Woods added a comment -

          how mdl_grade_items (course=11262) looked after the upgrade of assignments

          Show
          Michael Woods added a comment - how mdl_grade_items (course=11262) looked after the upgrade of assignments
          Hide
          Michael Woods added a comment -

          Note the duplicated assignments

          Show
          Michael Woods added a comment - Note the duplicated assignments
          Hide
          Charles Fulton added a comment -

          Hopefully no one minds but I'm raising this to blocker. This effectively bricks a course, since the assignment(s) in question and the gradebook is no longer accessible. Here's a stack trace from 20120612:

          Debug info:
          Error code: morethanonerecordinfetch
          Stack trace:
          line 467 of /lib/setuplib.php: moodle_exception thrown
          line 163 of /lib/grade/grade_object.php: call to print_error()
          line 326 of /lib/grade/grade_item.php: call to grade_object::fetch_helper()
          line 979 of /lib/grade/grade_item.php: call to grade_item::fetch()
          line 1010 of /lib/gradelib.php: call to grade_item::fetch_course_item()
          line 106 of /grade/report/grader/index.php: call to grade_regrade_final_grades()

          Show
          Charles Fulton added a comment - Hopefully no one minds but I'm raising this to blocker. This effectively bricks a course, since the assignment(s) in question and the gradebook is no longer accessible. Here's a stack trace from 20120612: Debug info: Error code: morethanonerecordinfetch Stack trace: line 467 of /lib/setuplib.php: moodle_exception thrown line 163 of /lib/grade/grade_object.php: call to print_error() line 326 of /lib/grade/grade_item.php: call to grade_object::fetch_helper() line 979 of /lib/grade/grade_item.php: call to grade_item::fetch() line 1010 of /lib/gradelib.php: call to grade_item::fetch_course_item() line 106 of /grade/report/grader/index.php: call to grade_regrade_final_grades()
          Hide
          Damyon Wiese added a comment -

          Thanks - I agree this is a blocker - I'll look at it right now.

          Show
          Damyon Wiese added a comment - Thanks - I agree this is a blocker - I'll look at it right now.
          Hide
          Damyon Wiese added a comment -

          Do not create the grade item on upgrade because we already reused the grade item from the old assignment.

          Show
          Damyon Wiese added a comment - Do not create the grade item on upgrade because we already reused the grade item from the old assignment.
          Hide
          Damyon Wiese added a comment -

          (Removed testing instructions from description)

          Show
          Damyon Wiese added a comment - (Removed testing instructions from description)
          Hide
          Damyon Wiese added a comment -

          Hi Michael,

          The patch here fixes the issue for me - I'm not sure when this regression slipped in. Any re-testing that you could do on this issue would be greatly appreciated (particularly around overwriting the category grade items). The fix is to remove one line from /mod/assign/upgradelib.php (see the pull master diff url above). Also - how long did it take for you to upgrade 24,000 assignments?

          Regards, Damyon

          Show
          Damyon Wiese added a comment - Hi Michael, The patch here fixes the issue for me - I'm not sure when this regression slipped in. Any re-testing that you could do on this issue would be greatly appreciated (particularly around overwriting the category grade items). The fix is to remove one line from /mod/assign/upgradelib.php (see the pull master diff url above). Also - how long did it take for you to upgrade 24,000 assignments? Regards, Damyon
          Hide
          Ankit Agarwal added a comment - - edited

          Hi Damyon,
          This looks great.
          can you update the testing instructions please? so that it checks if it is fixed, instead of trying to reproduce it.
          Feel free to submit this for integration.
          Thanks

          Show
          Ankit Agarwal added a comment - - edited Hi Damyon, This looks great. can you update the testing instructions please? so that it checks if it is fixed, instead of trying to reproduce it. Feel free to submit this for integration. Thanks
          Hide
          Damyon Wiese added a comment -

          Testing instructions updated.

          Show
          Damyon Wiese added a comment - Testing instructions updated.
          Hide
          Damyon Wiese added a comment -

          Thanks Ankit, sending for integration.

          Show
          Damyon Wiese added a comment - Thanks Ankit, sending for integration.
          Hide
          Michael Woods added a comment -

          Thanks Damyon. I'm offline for a couple of days, but will try to rerun a large test soon (I'll time it, and let you know how long it takes).

          Show
          Michael Woods added a comment - Thanks Damyon. I'm offline for a couple of days, but will try to rerun a large test soon (I'll time it, and let you know how long it takes).
          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
          Frédéric Massart added a comment -

          And the test passes! Thanks guys!

          Show
          Frédéric Massart added a comment - And the test passes! Thanks guys!
          Hide
          Eloy Lafuente (stronk7) added a comment -

          Big thanks for the effort. This is now part of Moodle upstream. Let's wait for regressions, yay! LOL

          Ciao

          Show
          Eloy Lafuente (stronk7) added a comment - Big thanks for the effort. This is now part of Moodle upstream. Let's wait for regressions, yay! LOL Ciao
          Hide
          Michael Woods added a comment -

          Time to convert 24,500 assignment was about 4 hours.

          I'm no longer getting the duplication of grade items, BUT on my freshly upgraded 1.9 site, the grade_item records where itemtype='category' are getting their itemmodule values changed from NULL to 'assign'. In fact the only grade_item records that are not getting updated to 'assign' are the manual grade item records (itemtype='manual'). However, when I try to create a simple test in the upgraded site (new course, new gradebook setup with categories and sub-categories), I cannot replicate the bug. That is, the assignment upgrade routine only touches the assignment records.

          I'll let you know if I can work anything out.

          Thanks,
          Michael

          Show
          Michael Woods added a comment - Time to convert 24,500 assignment was about 4 hours. I'm no longer getting the duplication of grade items, BUT on my freshly upgraded 1.9 site, the grade_item records where itemtype='category' are getting their itemmodule values changed from NULL to 'assign'. In fact the only grade_item records that are not getting updated to 'assign' are the manual grade item records (itemtype='manual'). However, when I try to create a simple test in the upgraded site (new course, new gradebook setup with categories and sub-categories), I cannot replicate the bug. That is, the assignment upgrade routine only touches the assignment records. I'll let you know if I can work anything out. Thanks, Michael
          Hide
          Michael Woods added a comment -

          Example of category records in grade_items getting overwritten by the new assignment module during upgrade.

          Show
          Michael Woods added a comment - Example of category records in grade_items getting overwritten by the new assignment module during upgrade.

            People

            • Votes:
              19 Vote for this issue
              Watchers:
              9 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: