MDL-82450 tool_task: format fail delay in scheduled tasks list.

This commit is contained in:
Paul Holden 2024-07-11 17:13:14 +01:00
parent 2b337b49f9
commit a42e43ba55
No known key found for this signature in database
GPG Key ID: A81A96D6045F6164
2 changed files with 8 additions and 8 deletions

View File

@ -398,8 +398,8 @@ class tool_task_renderer extends plugin_renderer_base {
get_string('runnow', 'tool_task')), 'task-runnow');
}
$faildelaycell = new html_table_cell($task->get_fail_delay());
if ($task->get_fail_delay()) {
if ($faildelay = $task->get_fail_delay()) {
$faildelaycell = new html_table_cell(format_time($faildelay));
$faildelaycell->text .= html_writer::div(
$this->output->single_button(
new moodle_url('/admin/tool/task/clear_fail_delay.php',
@ -409,6 +409,8 @@ class tool_task_renderer extends plugin_renderer_base {
'task-runnow'
);
$faildelaycell->attributes['class'] = 'table-danger';
} else {
$faildelaycell = new html_table_cell(0);
}
$row = new html_table_row([

View File

@ -10,23 +10,21 @@ Feature: Clear scheduled task fail delay
And I navigate to "Server > Tasks > Scheduled tasks" in site administration
Scenario: Any fail delay is highlighted
Then I should see "60" in the "Send new user passwords" "table_row"
Then I should see "1 min" in the "Send new user passwords" "table_row"
And I should see "Clear" in the "Send new user passwords" "table_row"
And I should see "60" in the "td.table-danger" "css_element"
And I should see "1 min" in the "td.table-danger" "css_element"
Scenario: Clear fail delay
When I click on "Clear" "text" in the "Send new user passwords" "table_row"
And I should see "Are you sure you want to clear the fail delay"
And I press "Clear"
Then I should not see "60" in the "Send new user passwords" "table_row"
Then I should not see "1 min" in the "Send new user passwords" "table_row"
And I should not see "Clear" in the "Send new user passwords" "table_row"
And I should see "Send new user passwords" in the "tr.table-primary" "css_element"
Scenario: Cancel clearing the fail delay
When I click on "Clear" "text" in the "Send new user passwords" "table_row"
And I press "Cancel"
Then I should see "60" in the "Send new user passwords" "table_row"
Then I should see "1 min" in the "Send new user passwords" "table_row"
And I should see "Clear" in the "Send new user passwords" "table_row"
And I should see "Send new user passwords" in the "tr.table-primary" "css_element"