Merge branch 'MDL-67686' of git://github.com/paulholden/moodle

This commit is contained in:
Andrew Nicols 2021-09-28 15:17:23 +08:00
commit 6ca7e3115a
6 changed files with 297 additions and 0 deletions

View file

@ -17,6 +17,7 @@
namespace core_admin\local\entities;
use core_reportbuilder\local\filters\date;
use core_reportbuilder\local\filters\duration;
use core_reportbuilder\local\filters\select;
use core_reportbuilder\local\filters\text;
use core_reportbuilder\local\helpers\format;
@ -282,6 +283,16 @@ class task_log extends base {
))
->add_joins($this->get_joins());
// Duration filter.
$filters[] = (new filter(
duration::class,
'duration',
new lang_string('task_duration', 'admin'),
$this->get_entity_name(),
"${tablealias}.timeend - {$tablealias}.timestart"
))
->add_joins($this->get_joins());
return $filters;
}
}

View file

@ -124,6 +124,7 @@ class task_logs extends system_report {
'task_log:output',
'task_log:result',
'task_log:timestart',
'task_log:duration',
];
$this->add_filters_from_entities($filters);

View file

@ -29,3 +29,22 @@ Feature: View task logs report and use its filters
| name | match | nonmatch |
| task\\clean_events | Cleanup event monitor events | Incoming email pickup |
| task\\pickup_task | Incoming email pickup | Cleanup event monitor events |
@javascript
# Task duration is dependent on many factors, we are asserting here that no task has a duration >2 minutes.
Scenario Outline: Filter task logs by duration
Given I log in as "admin"
And I change window size to "large"
And I navigate to "Server > Tasks > Task logs" in site administration
When I click on "Filters" "button"
And I set the following fields in the "Duration" "core_reportbuilder > Filter" to these values:
| Duration operator | <operator> |
| Duration value | 2 |
| Duration unit | minutes |
And I click on "Apply" "button" in the "[data-region='report-filters']" "css_element"
Then I should see "Filters applied"
And I <shouldornotsee> "Nothing to display"
Examples:
| operator | shouldornotsee |
| Less than | should not see |
| Greater than | should see |