mirror of
https://github.com/moodle/moodle.git
synced 2025-04-22 17:02:03 +02:00
MDL-82466 completion: format time duration in report entity columns.
Where the previous output was simple count of days, switch to using the new format helper to return a time duration. AMOS BEGIN CPY [daystakingcourse,core_course],[daystakingcourse,core_completion] AMOS END
This commit is contained in:
parent
8426610258
commit
c10610d035
@ -224,7 +224,7 @@ class completion extends base {
|
||||
$currenttime = time();
|
||||
$columns[] = (new column(
|
||||
'dayscourse',
|
||||
new lang_string('daystakingcourse', 'course'),
|
||||
new lang_string('daystakingcourse', 'completion'),
|
||||
$this->get_entity_name()
|
||||
))
|
||||
->add_joins($this->get_joins())
|
||||
@ -236,9 +236,10 @@ class completion extends base {
|
||||
{$coursecompletion}.timecompleted
|
||||
ELSE
|
||||
{$currenttime}
|
||||
END - {$course}.startdate) / " . DAYSECS . "
|
||||
END - {$course}.startdate)
|
||||
END)", 'dayscourse')
|
||||
->set_is_sortable(true);
|
||||
->set_is_sortable(true)
|
||||
->set_callback([format::class, 'format_time']);
|
||||
|
||||
// Days since last completion (days since last enrolment date until completion or until current date if not completed).
|
||||
$columns[] = (new column(
|
||||
@ -255,9 +256,10 @@ class completion extends base {
|
||||
{$coursecompletion}.timecompleted
|
||||
ELSE
|
||||
{$currenttime}
|
||||
END - {$coursecompletion}.timeenrolled) / " . DAYSECS . "
|
||||
END - {$coursecompletion}.timeenrolled)
|
||||
END)", 'daysuntilcompletion')
|
||||
->set_is_sortable(true);
|
||||
->set_is_sortable(true)
|
||||
->set_callback([format::class, 'format_time']);
|
||||
|
||||
// Student course grade.
|
||||
$columns[] = (new column(
|
||||
|
@ -235,8 +235,8 @@ final class participants_test extends core_reportbuilder_testcase {
|
||||
'', // Time started.
|
||||
userdate($timecompleted), // Time completed.
|
||||
'', // Reagreggate.
|
||||
2, // Days taking course.
|
||||
2, // Days until completion.
|
||||
'2 days', // Days taking course.
|
||||
'2 days', // Days until completion.
|
||||
'42.50', // Grade.
|
||||
], array_values($content[0]));
|
||||
}
|
||||
@ -310,7 +310,7 @@ final class participants_test extends core_reportbuilder_testcase {
|
||||
|
||||
$content = $this->get_custom_report_content($report->get('id'));
|
||||
$this->assertEquals([
|
||||
[$courseone->fullname, '2.5'],
|
||||
[$courseone->fullname, '2 days 12 hours'],
|
||||
[$coursetwo->fullname, ''],
|
||||
], array_map('array_values', $content));
|
||||
}
|
||||
|
@ -140,7 +140,8 @@ $string['csvdownload'] = 'Download in spreadsheet format (UTF-8 .csv)';
|
||||
$string['datepassed'] = 'Date passed';
|
||||
$string['days'] = 'Days';
|
||||
$string['daysoftotal'] = '{$a->days} of {$a->total}';
|
||||
$string['daysuntilcompletion'] = 'Days until completion';
|
||||
$string['daystakingcourse'] = 'Time taking course';
|
||||
$string['daysuntilcompletion'] = 'Time until completion';
|
||||
$string['defaultactivitycompletionsite'] = 'These are the default completion conditions for activities in all courses.';
|
||||
$string['defaultactivitycompletioncourse'] = 'These are the default completion conditions for activities in this course.';
|
||||
$string['defaultcompletion'] = 'Default activity completion';
|
||||
|
@ -85,7 +85,6 @@ $string['customfield_visibility_help'] = 'This setting determines who can view t
|
||||
$string['customfield_visibletoall'] = 'Everyone';
|
||||
$string['customfield_visibletoteachers'] = 'Teachers';
|
||||
$string['customfieldsettings'] = 'Common course custom fields settings';
|
||||
$string['daystakingcourse'] = 'Days taking course';
|
||||
$string['defaultsettingscategory'] = 'Default settings';
|
||||
$string['downloadcourseconfirmation'] = 'You are about to download a zip file of course content (excluding items which cannot be downloaded and any files larger than {$a}).';
|
||||
$string['downloadcoursecontent'] = 'Download course content';
|
||||
@ -167,3 +166,6 @@ $string['gotosection'] = 'Go to section {$a}';
|
||||
|
||||
// Deprecated since Moodle 4.3.
|
||||
$string['aria:courseimage'] = 'Course image';
|
||||
|
||||
// Deprecated since Moodle 4.5.
|
||||
$string['daystakingcourse'] = 'Days taking course';
|
||||
|
@ -116,6 +116,7 @@ coursecalendar,core_calendar
|
||||
importcalendarexternal,core_calendar
|
||||
nocalendarsubscriptions,core_calendar
|
||||
datechanged,core
|
||||
daystakingcourse,core_course
|
||||
siteregistrationcontact,core_hub
|
||||
siteregistrationcontact_help,core_hub
|
||||
registrationcontactno,core
|
||||
|
Loading…
x
Reference in New Issue
Block a user