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

Restoring a course backup without the 'General' section and with user data leads to duplicate entries in grade_grades

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Duplicate
    • Affects Version/s: 2.1.5
    • Fix Version/s: None
    • Component/s: Gradebook
    • Labels:
      None
    • Affected Branches:
      MOODLE_21_STABLE

      Description

      Noticed whilst confirming the fix for MDL-31589:

      As an administrator:

      • Create a new graded item. I confirmed with both an Online Text assignment, and Lesson
        As a student
      • Submit an attempt at said graded item such that a gradebook entry is now present in mdl_grade_grades

      As administrator:

      • Backup the course:
        • Include User Data
        • Do not include the 'General' section, but do include the section with the activity in question
      • Restore the backup:
        • Go through all steps, merging in to the existing course

      What you see:
      Bang from duplicate userid, itemid index on grade_grades

      It looks like backup/moodle2/restore_stepslib.php restore_gradebook_structure_step::process_grade_grade always tries an insert, even though process_grade_item may update an existing record

      Not sure whether we should update the existing grade_grade record or ignore the newest data?

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                andyjdavis Andrew Davis
                Reporter:
                dobedobedoh Andrew Nicols
                Participants:
                Component watchers:
                Víctor Déniz Falcón
              • Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: