From a42e43ba55028fdbadf6ec6cdc017ed98e42c701 Mon Sep 17 00:00:00 2001 From: Paul Holden Date: Thu, 11 Jul 2024 17:13:14 +0100 Subject: [PATCH] MDL-82450 tool_task: format fail delay in scheduled tasks list. --- admin/tool/task/renderer.php | 6 ++++-- admin/tool/task/tests/behat/clear_fail_delay.feature | 10 ++++------ 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/admin/tool/task/renderer.php b/admin/tool/task/renderer.php index 5c8366395e2..02bb26c79a7 100644 --- a/admin/tool/task/renderer.php +++ b/admin/tool/task/renderer.php @@ -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([ diff --git a/admin/tool/task/tests/behat/clear_fail_delay.feature b/admin/tool/task/tests/behat/clear_fail_delay.feature index ceee8678297..35f18420b5b 100644 --- a/admin/tool/task/tests/behat/clear_fail_delay.feature +++ b/admin/tool/task/tests/behat/clear_fail_delay.feature @@ -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"