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

Assignment restore fails with deleted group

XMLWordPrintable

    • MOODLE_35_STABLE, MOODLE_36_STABLE
    • MOODLE_35_STABLE
    • MDL-63798_assign_restore_groups
    • Hide
      • Create a course
      • Create a group
      • Enrol 2 students in the course, 1 in the group, 1 not in the group
      • Create an assignment, with group submission on, but do not require users to be a member of a group to submit
      • Log in as each of the students and submit something for the assignment
      • Log back in as admin and delete the group
      • Backup + restore the course

      Check:

      • Course restores without any errors
      Show
      Create a course Create a group Enrol 2 students in the course, 1 in the group, 1 not in the group Create an assignment, with group submission on, but do not require users to be a member of a group to submit Log in as each of the students and submit something for the assignment Log back in as admin and delete the group Backup + restore the course Check: Course restores without any errors

      Steps to reproduce:

      • Create a course
      • Create a group
      • Enrol 2 users in the course, 1 in the group, 1 not in the group
      • Create an assignment, with group submission on, but do not require users to be a member of a group to submit
      • Log in as each of the users and submit something for the assignment
      • Log back in as admin and delete the group
      • Backup + restore the course

      Expected result:

      • Backup restores successfully

      Actual result:

      • Error: "ERROR: duplicate key value violates unique constraint "mdl_assisubm_assusegroatt_uix"
        DETAIL: Key (assignment, userid, groupid, attemptnumber)=(2, 0, 0, 0) already exists.
        INSERT INTO mdl_assign_submission (userid,timecreated,timemodified,status,groupid,attemptnumber,latest,assignment) VALUES($1,$2,$3,$4,$5,$6,$7,$8) RETURNING id
        [array (
        'userid' => '0',
        'timecreated' => '1540804290',
        'timemodified' => '1540804297',
        'status' => 'submitted',
        'groupid' => 0,
        'attemptnumber' => '0',
        'latest' => 0,
        'assignment' => 2,
        )]
        Error code: dmlwriteexception"

      Reason: during restore, mod_assign maps any groupids it can't find onto 0 (no group), but there is already a no group submission in the same backup, so this causes the unique key violation.

      Suggested fix: skip restore of any assign submissions where the groupid is set but the group does not exist in the backup (as those submissions cannot be viewed anyway).

        1. MDL-63798.PNG
          22 kB
          Anna Carissa Sadia

            davosmith Davo Smith
            davosmith Davo Smith
            Damyon Wiese Damyon Wiese
            Eloy Lafuente (stronk7) Eloy Lafuente (stronk7)
            Anna Carissa Sadia Anna Carissa Sadia
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved:

                Estimated:
                Original Estimate - 0 minutes
                0m
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 30 minutes
                30m

                  Error rendering 'clockify-timesheets-time-tracking-reports:timer-sidebar'. Please contact your Jira administrators.