Uploaded image for project: '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:

      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'.

        Gliffy Diagrams

          Attachments

            Issue Links

              Activity

              Hide
              mcwoods Michael Woods added a comment -

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

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

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

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

              Note the duplicated assignments

              Show
              mcwoods Michael Woods added a comment - Note the duplicated assignments
              Hide
              cfulton 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
              cfulton 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 Damyon Wiese added a comment -

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

              Show
              damyon Damyon Wiese added a comment - Thanks - I agree this is a blocker - I'll look at it right now.
              Hide
              damyon 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 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 Damyon Wiese added a comment -

              (Removed testing instructions from description)

              Show
              damyon Damyon Wiese added a comment - (Removed testing instructions from description)
              Hide
              damyon 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 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_frenz 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_frenz 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 Damyon Wiese added a comment -

              Testing instructions updated.

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

              Thanks Ankit, sending for integration.

              Show
              damyon Damyon Wiese added a comment - Thanks Ankit, sending for integration.
              Hide
              mcwoods 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
              mcwoods 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
              poltawski Dan Poltawski added a comment -

              Thanks, i've integrated this now

              Show
              poltawski Dan Poltawski added a comment - Thanks, i've integrated this now
              Hide
              fred Frédéric Massart added a comment -

              And the test passes! Thanks guys!

              Show
              fred Frédéric Massart added a comment - And the test passes! Thanks guys!
              Hide
              stronk7 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
              stronk7 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
              mcwoods 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
              mcwoods 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
              mcwoods Michael Woods added a comment -

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

              Show
              mcwoods 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:
                    Fix Release Date:
                    25/Jun/12