MDL-66970 analytics: Fix incorrect use of ??

This commit is contained in:
David Monllaó 2019-10-17 17:08:51 +08:00
parent aaff6692a1
commit b00d35a6fc

View File

@ -302,8 +302,20 @@ abstract class course_enrolments extends \core_analytics\local\target\binary {
protected function enrolment_active_during_analysis_time(int $sampleid, int $starttime, int $endtime) {
$userenrol = $this->retrieve('user_enrolments', $sampleid);
$enrolstart = $userenrol->timestart ?? $userenrol->timecreated;
$enrolend = $userenrol->timeend ?? PHP_INT_MAX;
if (!empty($userenrol->timestart)) {
$enrolstart = $userenrol->timestart;
} else {
// This is always set.
$enrolstart = $userenrol->timecreated;
}
if (!empty($userenrol->timeend)) {
$enrolend = $userenrol->timeend;
} else {
// Default to tre end of the world.
$enrolend = PHP_INT_MAX;
}
if ($endtime && $endtime < $enrolstart) {
/* The enrolment starts/ed after the analysis end time.