mirror of
https://github.com/moodle/moodle.git
synced 2025-04-15 05:25:08 +02:00
MDL-77062 reportbuilder: Add filters/conditions for completion entity
This commit will add missing fields as Time enrolled/started/reaggregated in the filter/condition area for the completion entity when creating a course participants as a report source in the Report Builder.
This commit is contained in:
parent
880462a168
commit
43c64bc141
@ -275,6 +275,45 @@ class completion extends base {
|
||||
date::DATE_CURRENT,
|
||||
]);
|
||||
|
||||
// Time enrolled/started filter and condition.
|
||||
$fields = ['timeenrolled', 'timestarted'];
|
||||
foreach ($fields as $field) {
|
||||
$filters[] = (new filter(
|
||||
date::class,
|
||||
$field,
|
||||
new lang_string($field, 'enrol'),
|
||||
$this->get_entity_name(),
|
||||
"{$coursecompletion}.{$field}"
|
||||
))
|
||||
->add_joins($this->get_joins())
|
||||
->set_limited_operators([
|
||||
date::DATE_ANY,
|
||||
date::DATE_NOT_EMPTY,
|
||||
date::DATE_EMPTY,
|
||||
date::DATE_RANGE,
|
||||
date::DATE_LAST,
|
||||
date::DATE_CURRENT,
|
||||
]);
|
||||
}
|
||||
|
||||
// Time reaggregated filter and condition.
|
||||
$filters[] = (new filter(
|
||||
date::class,
|
||||
'reaggregate',
|
||||
new lang_string('timereaggregated', 'enrol'),
|
||||
$this->get_entity_name(),
|
||||
"{$coursecompletion}.reaggregate"
|
||||
))
|
||||
->add_joins($this->get_joins())
|
||||
->set_limited_operators([
|
||||
date::DATE_ANY,
|
||||
date::DATE_NOT_EMPTY,
|
||||
date::DATE_EMPTY,
|
||||
date::DATE_RANGE,
|
||||
date::DATE_LAST,
|
||||
date::DATE_CURRENT,
|
||||
]);
|
||||
|
||||
return $filters;
|
||||
}
|
||||
}
|
||||
|
@ -210,6 +210,27 @@ class participants_test extends core_reportbuilder_testcase {
|
||||
],
|
||||
'Lionel'
|
||||
],
|
||||
[
|
||||
'completion:timeenrolled',
|
||||
[
|
||||
'completion:timeenrolled_operator' => date::DATE_NOT_EMPTY,
|
||||
],
|
||||
'Lionel'
|
||||
],
|
||||
[
|
||||
'completion:timestarted',
|
||||
[
|
||||
'completion:timestarted_operator' => date::DATE_NOT_EMPTY,
|
||||
],
|
||||
'Lionel'
|
||||
],
|
||||
[
|
||||
'completion:reaggregate',
|
||||
[
|
||||
'completion:reaggregate_operator' => date::DATE_NOT_EMPTY,
|
||||
],
|
||||
'Lionel'
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
@ -254,6 +275,7 @@ class participants_test extends core_reportbuilder_testcase {
|
||||
// Mark course as completed for the user.
|
||||
$ccompletion = new completion_completion(array('course' => $course->id, 'userid' => $user1->id));
|
||||
$ccompletion->mark_enrolled($timestart);
|
||||
$ccompletion->mark_inprogress($timestart);
|
||||
$ccompletion->mark_complete($timecompleted);
|
||||
|
||||
// Set some last access value for the user in the course.
|
||||
|
Loading…
x
Reference in New Issue
Block a user