Moodle
  1. Moodle
  2. MDL-28180

If you duplicate an assignment in Moodle 2.1 that has course completion enabled, it breaks course completion for the course

    Details

    • Database:
      MySQL
    • Testing Instructions:
      Hide

      IMPORTANT: Testing this requires git-abilities in order to switch of branch and/or apply patches.

      IMPORTANT: This needs to be tested on all 2.x branches and master, so all the steps below are for each branch:

      1) BEFORE applying the patch, create one course, with course completion enabled.

      2) Add 1-2 students to it.

      3) create one activity (any is ok), for example one "page" and define activity completion to require viewing the resource.

      4) define course completion to include the page resource just created.

      5) logged as student, view the page.

      6) TEST: As admin, look to the course-completion report and verify that the student appears to have completed the page resource.

      7) Backup the course, with users and all activities.

      8) duplicate the activity (x2 icon). Should end ok. (Note, in 20_STABLE where the duplication feature was not available you can go to the page resource and then perform one backup & restore of that activity. It's 100% equivalent).

      9) TEST: go to the completion report. Error happens.

      10) TEST: Go to the DB, look the course_completion_aggr_methd table, some records for the course are duplicated.

      11) SWITCH to branch having the patch applied OR apply it for the current branch.

      12) Go to site main page. Upgrade process should be ignited.

      13) TEST: The upgrade process ends without error.

      14) TEST: Go to the DB, look the course_completion_aggr_methd table, the duplicate records in 10) are out.

      15) TEST: go to the completion report. No error happens.

      16) Duplicate the page resource again.

      17) TEST: go to the completion report. No error happens.

      18) TEST: The completion report continues showing only one page resource.

      19) Restore the course backup created in 7) restoring onto current course and adding information.

      20) TEST: The restore ends without problem

      21) TEST: go to the completion report. No error happens.

      22) TEST: In the completion report now there are 2 page resources shown, both with the student in 5) being shown as completed.

      Show
      IMPORTANT: Testing this requires git-abilities in order to switch of branch and/or apply patches. IMPORTANT: This needs to be tested on all 2.x branches and master, so all the steps below are for each branch: 1) BEFORE applying the patch, create one course, with course completion enabled. 2) Add 1-2 students to it. 3) create one activity (any is ok), for example one "page" and define activity completion to require viewing the resource. 4) define course completion to include the page resource just created. 5) logged as student, view the page. 6) TEST: As admin, look to the course-completion report and verify that the student appears to have completed the page resource. 7) Backup the course, with users and all activities. 8) duplicate the activity (x2 icon). Should end ok. (Note, in 20_STABLE where the duplication feature was not available you can go to the page resource and then perform one backup & restore of that activity. It's 100% equivalent). 9) TEST: go to the completion report. Error happens. 10) TEST: Go to the DB, look the course_completion_aggr_methd table, some records for the course are duplicated. 11) SWITCH to branch having the patch applied OR apply it for the current branch. 12) Go to site main page. Upgrade process should be ignited. 13) TEST: The upgrade process ends without error. 14) TEST: Go to the DB, look the course_completion_aggr_methd table, the duplicate records in 10) are out. 15) TEST: go to the completion report. No error happens. 16) Duplicate the page resource again. 17) TEST: go to the completion report. No error happens. 18) TEST: The completion report continues showing only one page resource. 19) Restore the course backup created in 7) restoring onto current course and adding information. 20) TEST: The restore ends without problem 21) TEST: go to the completion report. No error happens. 22) TEST: In the completion report now there are 2 page resources shown, both with the student in 5) being shown as completed.
    • Workaround:
      Hide

      Go to the database and manually delete all the duplicate entries in the tables mdl_course_completion_aggr_methd and mdl_course_completion_criteria associated with the course that has the problem. This fixes the issue.

      Show
      Go to the database and manually delete all the duplicate entries in the tables mdl_course_completion_aggr_methd and mdl_course_completion_criteria associated with the course that has the problem. This fixes the issue.
    • Affected Branches:
      MOODLE_21_STABLE
    • Fixed Branches:
      MOODLE_20_STABLE, MOODLE_21_STABLE, MOODLE_22_STABLE
    • Pull from Repository:
    • Pull Master Branch:
    • Rank:
      17795

      Description

      If you duplicate an assignment that has course completion enabled then course completion no longer works.
      If you then go to the course completion report, or the course completion settings you get the following errors.

      Found more than one record in fetch() !

      Debugging on

      More information about this error Stack trace:

      line 429 of /lib/setuplib.php: moodle_exception thrown

      line 130 of /lib/completion/data_object.php: call to print_error()

      line 83 of /lib/completion/completion_aggregation.php: call to data_object::fetch_helper()

      line 65 of /lib/completion/data_object.php: call to completion_aggregation::fetch()

      line 374 of /lib/completionlib.php: call to data_object->__construct()

      line 65 of /course/completion_form.php: call to completion_info->get_aggregation_method()

      line 152 of /lib/formslib.php: call to course_completion_form->definition()

      line 73 of /course/completion.php: call to moodleform->moodleform()

      The table mdl_course_completion_aggr_methd is then populated with 1000's of records relating to the course with the issue. Only fix is to delete these records. Then all works fine.

        Issue Links

          Activity

          Richard Ackland created issue -
          Richard Ackland made changes -
          Field Original Value New Value
          Priority Minor [ 4 ] Blocker [ 1 ]
          Michael de Raadt made changes -
          Fix Version/s STABLE backlog [ 10463 ]
          Labels triaged
          Sam Marshall made changes -
          Assignee Sam Marshall [ quen ] Aaron Barnes [ sry_not4sale ]
          Component/s Activity completion [ 10800 ]
          Aaron Barnes made changes -
          Workaround Go to the database and manually delete all the entries in table mdl_course_completion_aggr_methd associated with the course that has the problem. This fixes the issue. Go to the database and manually delete all the duplicate entries in the tables mdl_course_completion_aggr_methd and mdl_course_completion_criteria associated with the course that has the problem. This fixes the issue.
          Aaron Barnes made changes -
          Status Open [ 1 ] Development in progress [ 3 ]
          Aaron Barnes made changes -
          Component/s Backup [ 10068 ]
          Aaron Barnes made changes -
          Assignee Aaron Barnes [ sry_not4sale ] moodle.com [ moodle.com ]
          Aaron Barnes made changes -
          Assignee moodle.com [ moodle.com ] Eloy Lafuente (stronk7) [ stronk7 ]
          Sam Marshall made changes -
          Link This issue is duplicated by MDL-29985 [ MDL-29985 ]
          Eloy Lafuente (stronk7) made changes -
          Eloy Lafuente (stronk7) made changes -
          Eloy Lafuente (stronk7) made changes -
          Link This issue has a non-specific relationship to MDL-30692 [ MDL-30692 ]
          Eloy Lafuente (stronk7) made changes -
          Status Development in progress [ 3 ] Waiting for integration review [ 10010 ]
          Fix Version/s 2.0.7 [ 11451 ]
          Fix Version/s 2.1.4 [ 11452 ]
          Fix Version/s 2.2.1 [ 11456 ]
          Fix Version/s STABLE backlog [ 10463 ]
          Testing Instructions On moodle 2.1, duplicate an assignment (advanced uploading of files in my case) with course completion enabled. After that you should be unable to access the Course Completion report and the course completion settings.
          IMPORTANT: Testing this requires git-abilities in order to switch of branch and/or apply patches.

          IMPORTANT: This needs to be tested on all 2.x branches and master, so all the steps below are for each branch:

          1) BEFORE applying the patch, create one course, with course completion enabled.

          2) Add 1-2 students to it.

          3) create one activity (any is ok), for example one "page" and define activity completion to require viewing the resource.

          4) define course completion to include the page resource just created.

          5) logged as student, view the page.

          6) TEST: As admin, look to the course-completion report and verify that the student appears to have completed the page resource.

          7) Backup the course, with users and all activities.

          8) duplicate the activity (x2 icon). Should end ok.

          9) TEST: go to the completion report. Error happens.

          10) TEST: Go to the DB, look the course_completion_aggr_methd table, some records for the course are duplicated.

          11) SWITCH to branch having the patch applied OR apply it for the current branch.

          12) Go to site main page. Upgrade process should be ignited.

          13) TEST: The upgrade process ends without error.

          14) TEST: Go to the DB, look the course_completion_aggr_methd table, the duplicate records in 10) are out.

          15) TEST: go to the completion report. No error happens.

          16) Duplicate the page resource again.

          17) TEST: go to the completion report. No error happens.

          18) TEST: The completion report continues showing only one page resource.

          19) Restore the course backup created in 7) restoring onto current course and adding information.

          20) TEST: The restore ends without problem

          21) TEST: go to the completion report. No error happens.

          22) TEST: In the completion report now there are 2 page resources shown, both with the student in 5) being shown as completed.
          Eloy Lafuente (stronk7) made changes -
          Testing Instructions IMPORTANT: Testing this requires git-abilities in order to switch of branch and/or apply patches.

          IMPORTANT: This needs to be tested on all 2.x branches and master, so all the steps below are for each branch:

          1) BEFORE applying the patch, create one course, with course completion enabled.

          2) Add 1-2 students to it.

          3) create one activity (any is ok), for example one "page" and define activity completion to require viewing the resource.

          4) define course completion to include the page resource just created.

          5) logged as student, view the page.

          6) TEST: As admin, look to the course-completion report and verify that the student appears to have completed the page resource.

          7) Backup the course, with users and all activities.

          8) duplicate the activity (x2 icon). Should end ok.

          9) TEST: go to the completion report. Error happens.

          10) TEST: Go to the DB, look the course_completion_aggr_methd table, some records for the course are duplicated.

          11) SWITCH to branch having the patch applied OR apply it for the current branch.

          12) Go to site main page. Upgrade process should be ignited.

          13) TEST: The upgrade process ends without error.

          14) TEST: Go to the DB, look the course_completion_aggr_methd table, the duplicate records in 10) are out.

          15) TEST: go to the completion report. No error happens.

          16) Duplicate the page resource again.

          17) TEST: go to the completion report. No error happens.

          18) TEST: The completion report continues showing only one page resource.

          19) Restore the course backup created in 7) restoring onto current course and adding information.

          20) TEST: The restore ends without problem

          21) TEST: go to the completion report. No error happens.

          22) TEST: In the completion report now there are 2 page resources shown, both with the student in 5) being shown as completed.
          IMPORTANT: Testing this requires git-abilities in order to switch of branch and/or apply patches.

          IMPORTANT: This needs to be tested on all 2.x branches and master, so all the steps below are for each branch:

          1) BEFORE applying the patch, create one course, with course completion enabled.

          2) Add 1-2 students to it.

          3) create one activity (any is ok), for example one "page" and define activity completion to require viewing the resource.

          4) define course completion to include the page resource just created.

          5) logged as student, view the page.

          6) TEST: As admin, look to the course-completion report and verify that the student appears to have completed the page resource.

          7) Backup the course, with users and all activities.

          8) duplicate the activity (x2 icon). Should end ok. (Note, in 20_STABLE where the duplication feature was not available you can go to the page resource and then perform one backup & restore of that activity. It's 100% equivalent).

          9) TEST: go to the completion report. Error happens.

          10) TEST: Go to the DB, look the course_completion_aggr_methd table, some records for the course are duplicated.

          11) SWITCH to branch having the patch applied OR apply it for the current branch.

          12) Go to site main page. Upgrade process should be ignited.

          13) TEST: The upgrade process ends without error.

          14) TEST: Go to the DB, look the course_completion_aggr_methd table, the duplicate records in 10) are out.

          15) TEST: go to the completion report. No error happens.

          16) Duplicate the page resource again.

          17) TEST: go to the completion report. No error happens.

          18) TEST: The completion report continues showing only one page resource.

          19) Restore the course backup created in 7) restoring onto current course and adding information.

          20) TEST: The restore ends without problem

          21) TEST: go to the completion report. No error happens.

          22) TEST: In the completion report now there are 2 page resources shown, both with the student in 5) being shown as completed.
          Sam Hemelryk made changes -
          Status Waiting for integration review [ 10010 ] Integration review in progress [ 10004 ]
          Integrator samhemelryk
          Currently in integration Yes [ 10041 ]
          Sam Hemelryk made changes -
          Status Integration review in progress [ 10004 ] Waiting for testing [ 10005 ]
          Michael de Raadt made changes -
          Status Waiting for testing [ 10005 ] Testing in progress [ 10011 ]
          Tester salvetore
          Michael de Raadt made changes -
          Status Testing in progress [ 10011 ] Tested [ 10006 ]
          Andrew Nicols made changes -
          Link This issue is duplicated by MDL-30825 [ MDL-30825 ]
          Eloy Lafuente (stronk7) made changes -
          Status Tested [ 10006 ] Closed [ 6 ]
          Resolution Fixed [ 1 ]
          Currently in integration Yes [ 10041 ]
          Integration date 23/Dec/11
          Michael de Raadt made changes -
          Link This issue has been marked as being related by MDL-31441 [ MDL-31441 ]
          Mark Nelson made changes -
          Link This issue is duplicated by MDL-29870 [ MDL-29870 ]

            People

            • Votes:
              35 Vote for this issue
              Watchers:
              32 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: