Moodle
  1. Moodle
  2. MDL-36336

External tool assignment is duplicated in a restored course

    Details

    • Testing Instructions:
      Hide
      1. Create a course containing an External Tool assignment.
      2. Notice the gradebook has only one External Tool assignment
      3. Backup the course, using all defaults.
      4. Restore the course to a new course, taking defaults.
      5. Inspect the gradebook of the newly copied course.
      6. Verify: There should be only a single copy of the external tool activity.
      Show
      Create a course containing an External Tool assignment. Notice the gradebook has only one External Tool assignment Backup the course, using all defaults. Restore the course to a new course, taking defaults. Inspect the gradebook of the newly copied course. Verify: There should be only a single copy of the external tool activity.
    • Affected Branches:
      MOODLE_22_STABLE, MOODLE_23_STABLE
    • Fixed Branches:
      MOODLE_22_STABLE, MOODLE_23_STABLE
    • Pull Master Branch:
      MDL-36336_modLtiRestoreGrade

      Description

      When a course contains an External Tool assignment. Once that course is backed up and restored to a new course, then newly copied course contains a duplicate of that assignment in the gradebook. The duplicate cannot be removed via the UI.

      Steps to replicate:

      1. Create a course containing an External Tool assignment.
      2. Notice the gradebook has only one External Tool assignment
      3. Backup the course, using all defaults.
      4. Restore the course to a new course, taking defaults.
      5. Inspect the gradebook of the newly copied course.

      Expected result: There should be only a single copy of the external tool activity.

      Actual result: Two External tool assignments appear.

        Gliffy Diagrams

          Activity

          Hide
          Mary Cooch added a comment -

          I have just tested this on the School demo and I can confirm this has happened.

          Show
          Mary Cooch added a comment - I have just tested this on the School demo and I can confirm this has happened.
          Hide
          Michael de Raadt added a comment -

          Thanks for reporting that.

          I assume this is happening with imports also.

          Feel free to help us work on this issue. If you are able to provide a patch or links to your Git repository branch, please add a patch label so we will spot it.

          Show
          Michael de Raadt added a comment - Thanks for reporting that. I assume this is happening with imports also. Feel free to help us work on this issue. If you are able to provide a patch or links to your Git repository branch, please add a patch label so we will spot it.
          Hide
          Chris Follin added a comment -

          We're also finding that because the activity is duplicated in the restored course, trying to edit the activity results in an error message that more than one record was found by fetch().

          Show
          Chris Follin added a comment - We're also finding that because the activity is duplicated in the restored course, trying to edit the activity results in an error message that more than one record was found by fetch().
          Hide
          Mark Nielsen added a comment -

          Note for replicating: this only happens when the LTI instance's instructorchoiceacceptgrades is set to LTI_SETTING_ALWAYS (AKA 1).

          Show
          Mark Nielsen added a comment - Note for replicating: this only happens when the LTI instance's instructorchoiceacceptgrades is set to LTI_SETTING_ALWAYS (AKA 1).
          Hide
          Mark Nielsen added a comment -

          This fix for this is to not call lti_add_instance() during the restore process.

          Show
          Mark Nielsen added a comment - This fix for this is to not call lti_add_instance() during the restore process.
          Hide
          Dan Poltawski added a comment -

          Thanks a lot Mark, this looks good.

          Show
          Dan Poltawski added a comment - Thanks a lot Mark, this looks good.
          Hide
          Dan Poltawski added a comment -

          It'd be great if you can provide patches for 22 and 23, thanks!

          Show
          Dan Poltawski added a comment - It'd be great if you can provide patches for 22 and 23, thanks!
          Hide
          Mark Nielsen added a comment -

          Cherry picked to Moodle2.3 and 2.2

          Show
          Mark Nielsen added a comment - Cherry picked to Moodle2.3 and 2.2
          Hide
          Sam Hemelryk added a comment -

          Thanks Mark, this has been integrated now.

          Show
          Sam Hemelryk added a comment - Thanks Mark, this has been integrated now.
          Hide
          Michael de Raadt added a comment -

          Test result: Success!

          Tested in 2.2, 2.3 and master.

          Show
          Michael de Raadt added a comment - Test result: Success! Tested in 2.2, 2.3 and master.
          Hide
          Eloy Lafuente (stronk7) added a comment -

          Y E S !

          Closing as fixed, many thanks!

          Show
          Eloy Lafuente (stronk7) added a comment - Y E S ! Closing as fixed, many thanks!

            People

            • Votes:
              1 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: