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

    Details

    • Database:
      PostgreSQL
    • Testing Instructions:
      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.
    • Affected Branches:
      MOODLE_37_STABLE, MOODLE_38_STABLE
    • Fixed Branches:
      MOODLE_37_STABLE, MOODLE_38_STABLE
    • Pull from Repository:
    • Pull 3.7 Branch:
    • Pull 3.8 Branch:
    • Pull Master Branch:
      MDL-67204-master

      Description

      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.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              mwehr Mario Wehr
              Reporter:
              mwehr Mario Wehr
              Peer reviewer:
              Sara Arjona (@sarjona)
              Integrator:
              Andrew Nicols
              Tester:
              Anna Carissa Sadia
              Participants:
              Component watchers:
              Adrian Greeve, Jake Dallimore, Mathew May, Mihail Geshoski, Peter Dias
              Votes:
              4 Vote for this issue
              Watchers:
              12 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Fix Release Date:
                9/Mar/20

                  Time Tracking

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