MDL-79128 adhoc_task: Added 'Never' status for ad-hoc task Next run

Co-authored-by: Stevani Andolo <stevani.andolo@moodle.com>
This commit is contained in:
Huong Nguyen 2023-11-28 14:41:33 +07:00
parent f13392d230
commit bd3af64741
2 changed files with 14 additions and 2 deletions

View File

@ -119,7 +119,9 @@ class tool_task_renderer extends plugin_renderer_base {
// Prepares the next run time cell contents.
$nextrun = '';
if ($stats['due'] > 0) {
if ($stats['stop']) {
$nextrun = get_string('never', 'admin');
} else if ($stats['due'] > 0) {
$nextrun = get_string('asap', 'tool_task');
} else if ($stats['nextruntime']) {
$nextrun = userdate($stats['nextruntime']);
@ -271,7 +273,11 @@ class tool_task_renderer extends plugin_renderer_base {
if (!$started) {
$nextruntime = $task->get_next_run_time();
$due = $nextruntime < $now;
$nextrun = $due ? userdate($nextruntime) : get_string('asap', 'tool_task');
if ($task->get_attempts_available() > 0) {
$nextrun = $due ? userdate($nextruntime) : get_string('asap', 'tool_task');
} else {
$nextrun = get_string('never', 'admin');
}
if ($wantruntasks && ($faildelay || $due)) {
$nextrun .= ' '.html_writer::div(

View File

@ -543,6 +543,7 @@ class manager {
'failed' => 0,
'running' => 0,
'due' => 0,
'stop' => false,
];
}
@ -564,6 +565,11 @@ class manager {
}
}
// Mark the task as stopped if it has no attempts available.
if (isset($r->attemptsavailable) && $r->attemptsavailable == 0) {
$classsummary['stop'] = true;
}
$summary[$r->component][$r->classname] = $classsummary;
}
return $summary;