Moodle
  1. Moodle
  2. MDL-31957

Reset does not delete activity completion data

    Details

    • Testing Instructions:
      Hide

      1. Create 2 courses, course A and course B, and enable activity completion in both.
      2. In both A and B, add a couple of activities (e.g. labels) with manual completion turned on.
      3. In both A and B, turn editing off and tick the boxes.
      4. In A, go to reset course. Choose the 'Completion data' option and reset. Go back to main page.
      * Verify that both boxes in A are now not ticked. (This checks the session cache has been cleared.)
      5. Log out and log in again.
      * Verify that both boxes in A are still not ticked. (This checks the database entries have been cleared.)
      6. Look at course B.
      * Verify that both boxes are still ticked. (This checks I didn't accidentally wipe the entire table or something, and it only affects the course you're on.)

      Note: There are other things to test but clearing completion data is actually pretty simple

      Show
      1. Create 2 courses, course A and course B, and enable activity completion in both. 2. In both A and B, add a couple of activities (e.g. labels) with manual completion turned on. 3. In both A and B, turn editing off and tick the boxes. 4. In A, go to reset course. Choose the 'Completion data' option and reset. Go back to main page. * Verify that both boxes in A are now not ticked. (This checks the session cache has been cleared.) 5. Log out and log in again. * Verify that both boxes in A are still not ticked. (This checks the database entries have been cleared.) 6. Look at course B. * Verify that both boxes are still ticked. (This checks I didn't accidentally wipe the entire table or something, and it only affects the course you're on.) Note: There are other things to test but clearing completion data is actually pretty simple
    • Workaround:
      Hide

      As a workaround, it is possible to access every activity in the course and Unlock activity completion.

      Show
      As a workaround, it is possible to access every activity in the course and Unlock activity completion.
    • Affected Branches:
      MOODLE_22_STABLE, MOODLE_23_STABLE, MOODLE_24_STABLE
    • Fixed Branches:
      MOODLE_22_STABLE, MOODLE_23_STABLE
    • Pull Master Branch:
      MDL-31957-master
    • Rank:
      38619

      Description

      When doing a course reset where activity completion and course completion are enabled, reset erase attempts and completion data for activities except for SCORM. For SCORM, only attempts are deleted while activity completion data is kept.

      To reproduce in Moodle 2.2.1 build 20120213:

      Set up

      • in a site with completion and conditional subsystems enabled, create a course and enable completion tracking
      • add two SCORM (say, SC1 and SC2) activity and one quiz activity (say QZ1) to the course
      • for both SC1 and SC2 scorms, set completion criteria to "Student must view this activity to complete it"
      • for SC2 scorm, add conditional availability "SC1 scorm must be marked complete"
      • for QZ1 quiz, set completion criteria to "Student must receive a grade to complete this activity" and set conditional availability "SC2 scorm must be marked complete"
      • now set course completion criteria with Aggregation: ALL and select both SC1 and SC2 scorm as well as QZ1 quiz.
      • at this point you should end up with an activities sequence where a student 1) attempt SC1 and complete it, then 2) can attempt SC2 and complete it, then 3) can attempt the quiz and complete it. Once completed all three activities, student also completes the course.

      Test

      • access the course as student, attempt SC1, SC2 and QZ1
      • access again the course as admin, or with manager/teacher role
      • make sure course completion report shows student's completion for SC1, SC2, QZ1 and course.
      • click on "Reset" link from Course administration (Settings block)
      • for reset, select Course completion, Quiz and SCORM attempts
      • reset the course
      • Results: Quiz attempts deleted, SCORM attempts deleted, Course completion deleted, Quiz activity completion deleted, SCORM activity completion NOT deleted.

        Issue Links

          Activity

          Hide
          Dan Marsden added a comment -

          Hi Andrea,

          this sounds like a bigger problem to me - do any of the activities clear completion when reset is used?

          thanks,

          Dan

          Show
          Dan Marsden added a comment - Hi Andrea, this sounds like a bigger problem to me - do any of the activities clear completion when reset is used? thanks, Dan
          Hide
          Andrea Bicciolo added a comment -

          Hi Dan,

          according to the test we did, Quiz activity completion is cleared upon course reset. Looking at the activity settings after course reset, Quiz completion is unblocked and configurable again, while SCORM completion shows the "Unblock" button with the related warning. It is also possible to verify accessing the course completion report, where completion check marks are cleared after reset for course and quiz, but not for SCORM. Also, after course reset, completion check marks are present as well for scorm activities in the course home page.

          We have not tested more activities other than scorm and quiz, however further checks can be done. Let me know if you need access to a test bed with ready-to-test setup.

          Andrea

          Show
          Andrea Bicciolo added a comment - Hi Dan, according to the test we did, Quiz activity completion is cleared upon course reset. Looking at the activity settings after course reset, Quiz completion is unblocked and configurable again, while SCORM completion shows the "Unblock" button with the related warning. It is also possible to verify accessing the course completion report, where completion check marks are cleared after reset for course and quiz, but not for SCORM. Also, after course reset, completion check marks are present as well for scorm activities in the course home page. We have not tested more activities other than scorm and quiz, however further checks can be done. Let me know if you need access to a test bed with ready-to-test setup. Andrea
          Hide
          Dan Marsden added a comment -

          Hi Andrea,

          In my testing if the activity completion is based on a grade it resets the completion when only the option to "Delete all SCORM attempts" is selected.
          This seems to be the case with Quiz as well.

          If I select to allow manual activity completion - this doesn't clear when only the checkbox to delete attempts is selected - this also appears to behave the same for Quiz.

          it looks like deleting attempts will only delete certain types of completion data... looks more like a bug with the way the reset course feature handles completion - I wonder if the best option is to have a checkbox for each activity if completion is enabled - I'm passing this one on to whoever maintains activity completion these days as it doesn't appear (to me) to be specific to SCORM but a range of activities

          thanks!

          Show
          Dan Marsden added a comment - Hi Andrea, In my testing if the activity completion is based on a grade it resets the completion when only the option to "Delete all SCORM attempts" is selected. This seems to be the case with Quiz as well. If I select to allow manual activity completion - this doesn't clear when only the checkbox to delete attempts is selected - this also appears to behave the same for Quiz. it looks like deleting attempts will only delete certain types of completion data... looks more like a bug with the way the reset course feature handles completion - I wonder if the best option is to have a checkbox for each activity if completion is enabled - I'm passing this one on to whoever maintains activity completion these days as it doesn't appear (to me) to be specific to SCORM but a range of activities thanks!
          Hide
          Andrea Bicciolo added a comment -

          Hi Dan,

          On our test only Quiz activity is checked as complete when receiving a grade. Scorm is set to be complete upon view (no manual completion). If your test indicates that when activity completion is based on grade or manual reset then no completion data is cleared, that may explain why on our test bed quiz completion is cleared while scorm completion is not.

          Yes, it appears there are some inconsistencies on how completion data are reset, so an eye from Sam would surely help.

          Tty!

          Show
          Andrea Bicciolo added a comment - Hi Dan, On our test only Quiz activity is checked as complete when receiving a grade. Scorm is set to be complete upon view (no manual completion). If your test indicates that when activity completion is based on grade or manual reset then no completion data is cleared, that may explain why on our test bed quiz completion is cleared while scorm completion is not. Yes, it appears there are some inconsistencies on how completion data are reset, so an eye from Sam would surely help. Tty!
          Hide
          Sam Marshall added a comment -

          According to your test script, 'activity completion' wasn't one of the options you reset, only 'course completion' which is separate (& I'm not sure it is available on course reset screen, I've never looked). Is this true?

          If you want to reset the 'viewed y/n' flag, or the manual completion tickboxes, that would need to be done specifically by course reset. Removing SCORM attempts would have no affect on whether the user has viewed the SCORM; even if there are no attempts, they still viewed it.

          Probably this resets for quiz because the gradebook entries are changed; automatic completion based on grade will update itself when the gradebook changes.

          There may be other issues regarding automatic completion based on other things e.g. forum posts. Say you have a forum set to complete when somebody posts 3 times, then you reset forum posts, if the course reset feature does not properly support activity completion, then it is likely that a reset of the necessary completion data would not be triggered.

          I don't know anything about the course reset code but I suppose I might have to find out.

          Show
          Sam Marshall added a comment - According to your test script, 'activity completion' wasn't one of the options you reset, only 'course completion' which is separate (& I'm not sure it is available on course reset screen, I've never looked). Is this true? If you want to reset the 'viewed y/n' flag, or the manual completion tickboxes, that would need to be done specifically by course reset. Removing SCORM attempts would have no affect on whether the user has viewed the SCORM; even if there are no attempts, they still viewed it. Probably this resets for quiz because the gradebook entries are changed; automatic completion based on grade will update itself when the gradebook changes. There may be other issues regarding automatic completion based on other things e.g. forum posts. Say you have a forum set to complete when somebody posts 3 times, then you reset forum posts, if the course reset feature does not properly support activity completion, then it is likely that a reset of the necessary completion data would not be triggered. I don't know anything about the course reset code but I suppose I might have to find out.
          Hide
          Andrea Bicciolo added a comment -

          Hi Sam,

          in the course Reset page, there is no "Delete activity completion data" tickbox , but there is "Delete course completion data", and the latter appears to work. However, under certain circumstances, activity completion data are deleted upon reset. We made some test (like those performed by Dan) and up to now we discovered the following (for quiz and scorm only), when attempts are cleared using course reset:

          • activity with Manual completion enabled: upon reset of attempts, completion is not cleared for quiz nor scorm
          • activity with Require view for completion (thus automatic), upon reset of attempts completion is not cleared for quiz nor scorm
          • activity with Require view and Require grade for completion, upon reset of attempts completion is cleared for both quiz and scorm
          • activity Require grade for completion, upon reset of attempts completion is cleared for both quiz and scorm

          At this point I'm not sure if the above is intended or not and can't imagine, as Sam suggested, what can be all possible scenarios with so many Moodle activities when dealing with completion and reset. In any case a a check from you could be be valuable.

          Thanks!

          Show
          Andrea Bicciolo added a comment - Hi Sam, in the course Reset page, there is no "Delete activity completion data" tickbox , but there is "Delete course completion data", and the latter appears to work. However, under certain circumstances, activity completion data are deleted upon reset. We made some test (like those performed by Dan) and up to now we discovered the following (for quiz and scorm only), when attempts are cleared using course reset: activity with Manual completion enabled: upon reset of attempts, completion is not cleared for quiz nor scorm activity with Require view for completion (thus automatic), upon reset of attempts completion is not cleared for quiz nor scorm activity with Require view and Require grade for completion, upon reset of attempts completion is cleared for both quiz and scorm activity Require grade for completion, upon reset of attempts completion is cleared for both quiz and scorm At this point I'm not sure if the above is intended or not and can't imagine, as Sam suggested, what can be all possible scenarios with so many Moodle activities when dealing with completion and reset. In any case a a check from you could be be valuable. Thanks!
          Hide
          Ankit Agarwal added a comment -

          Just recording my observations...
          Manually marked activities' completion data is not deleted during a reset.
          If we have a option to delete course completion data during reset...it makes sense to have an option to support deleting activity completion data as well.

          Thanks

          Show
          Ankit Agarwal added a comment - Just recording my observations... Manually marked activities' completion data is not deleted during a reset. If we have a option to delete course completion data during reset...it makes sense to have an option to support deleting activity completion data as well. Thanks
          Hide
          Sam Marshall added a comment -

          OK, I agree. I'll look at making it so the existing checkbox is renamed to 'Delete completion data' and includes both course and activity completion data (as there is surely no logical reason to delete one but not the other).

          By the way, I'm not sure whether the reset feature already existed when I implemented completion originally, but if it did, I didn't notice it

          Show
          Sam Marshall added a comment - OK, I agree. I'll look at making it so the existing checkbox is renamed to 'Delete completion data' and includes both course and activity completion data (as there is surely no logical reason to delete one but not the other). By the way, I'm not sure whether the reset feature already existed when I implemented completion originally, but if it did, I didn't notice it
          Hide
          Sam Marshall added a comment -

          Implemented as described above - the option on reset form is changed to 'Reset completion data' and should now reset both course and activity completion.

          I have written a short test script above. It seems to work for me...

          Show
          Sam Marshall added a comment - Implemented as described above - the option on reset form is changed to 'Reset completion data' and should now reset both course and activity completion. I have written a short test script above. It seems to work for me...
          Hide
          Ankit Agarwal added a comment -

          Hey Sam,
          The code looks good to me. +1 for integration.
          I have added a bunch of labels to the issue, so that appropriate actions can be taken later on.
          Also it might be worth back-porting it to 23 and 22. I will leave it upto you to decide if this should be backported. In case you decide to backport, just for reference we donot delete strings in stable.
          Thanks

          Show
          Ankit Agarwal added a comment - Hey Sam, The code looks good to me. +1 for integration. I have added a bunch of labels to the issue, so that appropriate actions can be taken later on. Also it might be worth back-porting it to 23 and 22. I will leave it upto you to decide if this should be backported. In case you decide to backport, just for reference we donot delete strings in stable. Thanks
          Hide
          Sam Marshall added a comment -

          Thanks Ankit! Now submitting for integration. As you suggested, I have provided commits back to 22.

          The commit in 23 is a cherry-pick of the master commit, but with the deleted lang string added back in. The commit in 22 is an exact cherry-pick of the 23 commit.

          Show
          Sam Marshall added a comment - Thanks Ankit! Now submitting for integration. As you suggested, I have provided commits back to 22. The commit in 23 is a cherry-pick of the master commit, but with the deleted lang string added back in. The commit in 22 is an exact cherry-pick of the 23 commit.
          Hide
          Eloy Lafuente (stronk7) added a comment -

          Integrated, thanks! (22, 23 & master)

          Show
          Eloy Lafuente (stronk7) added a comment - Integrated, thanks! (22, 23 & master)
          Hide
          Rossiani Wijaya added a comment -

          Hi Sam,

          Testing this on master, it failed step #4. Reseting course's 'completetion data' does not removed the tick on the course main page.

          The tick is removed if the user logout and re-login to the site.

          Show
          Rossiani Wijaya added a comment - Hi Sam, Testing this on master, it failed step #4. Reseting course's 'completetion data' does not removed the tick on the course main page. The tick is removed if the user logout and re-login to the site.
          Hide
          Eloy Lafuente (stronk7) added a comment -

          Confirmed, the (session) ticks aren't cleaned.

          Show
          Eloy Lafuente (stronk7) added a comment - Confirmed, the (session) ticks aren't cleaned.
          Hide
          Eloy Lafuente (stronk7) added a comment -

          Ah, trivial, it's missing global $SESSION declaration, apparently. Checking...

          Show
          Eloy Lafuente (stronk7) added a comment - Ah, trivial, it's missing global $SESSION declaration, apparently. Checking...
          Hide
          Eloy Lafuente (stronk7) added a comment -

          Yeah, this simple change seems to make it work, so spreading it to all branches...

          https://github.com/stronk7/moodle/commit/7f4de36ddb085387d84044185a0b970dcc98cbc2

          Show
          Eloy Lafuente (stronk7) added a comment - Yeah, this simple change seems to make it work, so spreading it to all branches... https://github.com/stronk7/moodle/commit/7f4de36ddb085387d84044185a0b970dcc98cbc2
          Hide
          Eloy Lafuente (stronk7) added a comment -

          Re-integrated with the extra commit in all branches (22, 23 & master). Ready for a new testing session... ciao

          Show
          Eloy Lafuente (stronk7) added a comment - Re-integrated with the extra commit in all branches (22, 23 & master). Ready for a new testing session... ciao
          Hide
          Rossiani Wijaya added a comment -

          This looks good now.

          Thanks Eloy for fixing.

          Test passed.

          Show
          Rossiani Wijaya added a comment - This looks good now. Thanks Eloy for fixing. Test passed.
          Hide
          Eloy Lafuente (stronk7) added a comment -

          YEAR!*

          CAF*, TOT!*

          • Your effort amazingly resulted. (unbelievable :-P)
          • Closing as fixed.
          • Tons of thanks.
          Show
          Eloy Lafuente (stronk7) added a comment - YEAR!* CAF*, TOT!* Your effort amazingly resulted. (unbelievable :-P) Closing as fixed. Tons of thanks.
          Hide
          Mary Cooch added a comment -

          (Housekeeping) Removing docs_required label as this is clarified in the 2.3- 2.5 docs in http://docs.moodle.org/en/Reset_course

          Show
          Mary Cooch added a comment - (Housekeeping) Removing docs_required label as this is clarified in the 2.3- 2.5 docs in http://docs.moodle.org/en/Reset_course

            People

            • Votes:
              2 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: