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

Assignment calendar events with "alwaysshowdescription" get updated on every task run because of not updated "lastcron" field

XMLWordPrintable

    • PostgreSQL
    • MOODLE_37_STABLE, MOODLE_38_STABLE
    • MOODLE_37_STABLE, MOODLE_38_STABLE
    • MDL-67204-master
    • Hide

      Setup

      1. Login as admin.
      2. Create a new course or go to an existing one.
      3. Create a new Assignment with:
        • Allow submissions from date and set the date one day in the past.
        • Set due date a few days ahead to the future.
        • Always show description set to No

      Testing scenario

      1. Run the "Background processing for assignment module" task:

        php admin/tool/task/cli/schedule_task.php --execute="\mod_assign\task\cron_task"
        

      2. Wait for it to finish
      3. Go to "Site administration / Reports / Logs".
      4. Make a note of the latest log entry
      5. Run the "Background processing for assignment module" task again:

        php admin/tool/task/cli/schedule_task.php --execute="\mod_assign\task\cron_task"
        

      6. Wait for it to finish
      7. Refresh the list of the logs
        1. Verify you don't see any new "Calendar event updated" log entry for the corresponding calendar event.
      Show
      Setup Login as admin. Create a new course or go to an existing one. Create a new Assignment with: Allow submissions from date and set the date one day in the past. Set due date a few days ahead to the future. Always show description set to No Testing scenario Run the "Background processing for assignment module" task: php admin/tool/task/cli/schedule_task.php --execute="\mod_assign\task\cron_task" Wait for it to finish Go to "Site administration / Reports / Logs". Make a note of the latest log entry Run the "Background processing for assignment module" task again: php admin/tool/task/cli/schedule_task.php --execute="\mod_assign\task\cron_task" Wait for it to finish Refresh the list of the logs Verify you don't see any new "Calendar event updated" log entry for the corresponding calendar event.

      Currently the cron_task implementation of the assign module is calling the corresponding static cron function (mod/assign/locallib.php).
      One part of the assign cron function is to check the "allowsubmissionsfromdate" with the current date and "alwaysshowdescription = 0"
      to show the event description only after the "allowsubmissionsfromdate".
      The SQL query uses the "lastcron" field from the "modules" table which is not updated after the task run.
      The not updated "lastcron" field results in updates of the assignment calendar events on every task run -> a lot of log entries
      Moreover I think the field "lastcron" shouldn't be use anymore because tasks have there own "lastruntime" in the task_scheduled table.

      I would suggest to use "lastruntime" from the "task_scheduled" table to build the time window for the assignment query.

            mwehr Mario Wehr
            mwehr Mario Wehr
            Sara Arjona (@sarjona) Sara Arjona (@sarjona)
            Andrew Lyons Andrew Lyons
            Anna Carissa Sadia Anna Carissa Sadia
            Votes:
            4 Vote for this issue
            Watchers:
            12 Start watching this issue

              Created:
              Updated:
              Resolved:

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

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