-
Bug
-
Resolution: Fixed
-
Minor
-
3.5.5, 4.4.1, 4.4.6, 4.5.2
When using the course reset functionality on a course that as a start date with a time component (other than midnight) all other associated course dates/times are shifted in an unexpected way.
For example (reproduce):
To be carried out with a user whose timezone is the same as the main site setting
- Create a course setting the start date/time to a Monday at 09:00
- Add any activity (1) and set expected completion to 17:00 on the starting Monday
- Add an activity (2) that utilises/recognises reset timeshift (e.g. quiz) setting timeopen/timeclose settings to 13:00/16:00 on the starting Monday
- Use the course reset functionality change the course start date to Tuesday at 09:00
Expected date/time changes:
- Activity 1 expected completion date should be Tuesday at 17:00
- Activity 2 timeopen/timeclose dates should be Tuesday 13:00/16:00
Actual date/time changes:
- Activity 1 expected completion date is Wednesday at 02:00 (i.e. + 9 hours)
- Activity 2 timeopen/timeclose dates are Tuesday 22:00 and Wednesday 01:00 (i.e. + 9 hours)
This issue affects:
- Any/all module fields (if they are processed by the module implementation) via: moodlelib.php, shift_course_mod_dates()
- Any/all course/group events, expected completion dates and course end date via: moodlelib.php, reset_course_userdata()
This seems to stem from the main reset code basing the timeshift on the new course start date adjusted by the current user's midnight.
The quick fix for the issue is to always set the new course start date to midnight before resetting (and then changing back to the correct time afterwards).
Note, this issue may be to our use-case not matching the developer's intention for this functionality.