mirror of
https://github.com/moodle/moodle.git
synced 2025-01-17 13:38:32 +01:00
Merge branch 'MDL-74106' of https://github.com/paulholden/moodle
This commit is contained in:
commit
ecfc31191c
@ -207,7 +207,13 @@ class schedule {
|
||||
return false;
|
||||
}
|
||||
|
||||
return $schedule->get('timenextsend') <= $timenow;
|
||||
// If there's no recurrence, check whether it's been sent since initial scheduled start time. This ensures that even if
|
||||
// the schedule was manually sent beforehand, it'll still be automatically sent once the start time is first reached.
|
||||
if ($schedule->get('recurrence') === model::RECURRENCE_NONE) {
|
||||
return $schedule->get('timelastsent') < $timescheduled;
|
||||
}
|
||||
|
||||
return $schedule->get('timenextsend') <= $timenow;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -300,10 +300,25 @@ class schedule_test extends advanced_testcase {
|
||||
'recurrence' => model::RECURRENCE_NONE,
|
||||
'timescheduled' => $yesterday,
|
||||
], true],
|
||||
'Time scheduled in the past, already sent prior to schedule' => [[
|
||||
'recurrence' => model::RECURRENCE_NONE,
|
||||
'timescheduled' => $yesterday,
|
||||
'timelastsent' => $yesterday - HOURSECS,
|
||||
], true],
|
||||
'Time scheduled in the past, already sent on schedule' => [[
|
||||
'recurrence' => model::RECURRENCE_NONE,
|
||||
'timescheduled' => $yesterday,
|
||||
'timelastsent' => $yesterday,
|
||||
], false],
|
||||
'Time scheduled in the future' => [[
|
||||
'recurrence' => model::RECURRENCE_NONE,
|
||||
'timescheduled' => $tomorrow,
|
||||
], false],
|
||||
'Time scheduled in the future, already sent prior to schedule' => [[
|
||||
'recurrence' => model::RECURRENCE_NONE,
|
||||
'timelastsent' => $yesterday,
|
||||
'timescheduled' => $tomorrow,
|
||||
], false],
|
||||
'Next send in the past' => [[
|
||||
'recurrence' => model::RECURRENCE_DAILY,
|
||||
'timescheduled' => $yesterday,
|
||||
|
Loading…
x
Reference in New Issue
Block a user