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

Unexpected behaviour of course reset when using a course start time (timeshift)

XMLWordPrintable

      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

      1. Create a course setting the start date/time to a Monday at 09:00
      2. Add any activity (1) and set expected completion to 17:00 on the starting Monday
      3. 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
      4. 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.

        1. MDL-82206_afterreset.png
          41 kB
          Sara Arjona (@sarjona)
        2. MDL-82206_afterresetcoursesettings.png
          14 kB
          Sara Arjona (@sarjona)
        3. MDL-82206_beforereset.png
          41 kB
          Sara Arjona (@sarjona)
        4. image-2025-03-12-18-29-30-873.png
          13 kB
          Amaia Anabitarte

            sim642 Simmo Saan
            jjs105 Jon Spain
            Sara Arjona (@sarjona) Sara Arjona (@sarjona)
            Amaia Anabitarte Amaia Anabitarte
            CiBoT CiBoT
            Votes:
            2 Vote for this issue
            Watchers:
            10 Start watching this issue

              Created:
              Updated:
              Resolved:

                Estimated:
                Original Estimate - 0 minutes
                0m
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 3 hours, 10 minutes
                3h 10m

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