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

Repeated import results in duplicate manual grade items

    Details

    • Testing Instructions:
      Hide

      */ Create a new empty course
      */ Add a manual grade_item called manualtest (in the gradebook, goto: Categories and items / ► Simple view in the settings block and click 'Add grade item' from the page that comes up)
      */ Add a resource (a label for example) in the course.
      */ Use the duplicate icon to copy the resource in the course one or more times.
      */ Check the gradebook:

      If you have more than one item called 'manualtest', this fix has failed.

      If you have just the one item, this test has passed and the patch works as intended.

      Show
      */ Create a new empty course */ Add a manual grade_item called manualtest (in the gradebook, goto: Categories and items / ► Simple view in the settings block and click 'Add grade item' from the page that comes up) */ Add a resource (a label for example) in the course. */ Use the duplicate icon to copy the resource in the course one or more times. */ Check the gradebook: If you have more than one item called 'manualtest', this fix has failed. If you have just the one item, this test has passed and the patch works as intended.
    • Affected Branches:
      MOODLE_20_STABLE, MOODLE_21_STABLE, MOODLE_22_STABLE, MOODLE_23_STABLE
    • Fixed Branches:
      MOODLE_22_STABLE, MOODLE_23_STABLE, MOODLE_24_STABLE
    • Pull Master Branch:

      Description

      If you import content from a course that has grade_items of the 'manual' itemtype, these grade items are imported into your destination course.
      The problem comes in if you do a subsequent import, the manual grade items are imported /again/.

      This again highlights the issues around import importing stuff without giving the user the option to not include it (like groups) and not correctly checking for duplicates on doing so.

      There should probably be some check to see if the identical grade item already exists in the course. For manual grade_items this might be difficult to guarentee its the same grade_item however...

      To reproduce:
      */ Create a new empty course
      */ Add a manual grade_item
      */ Duplicate a resource in the course one or more times.
      You'll see the manual grade item has been imported as many times as you've done imports.

      This may not seem like a big deal, but if you chain these together, it gets insane. One course with say, 10 manual items, might get imported into a course 2 or 3 times (the teacher selecting different things to import each time), giving this course 20~30 items. Then another course imports from that course a couple times, getting 20~30 each time... and so on. This doubling effect quickly adds up, to the point I've seen what started as 4 manual grade items in a course now adding up to 258k grade_items in a course!

        Gliffy Diagrams

          Attachments

            Activity

              People

              • Votes:
                7 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Fix Release Date:
                  14/Jan/13