Merge branch 'MDL-65829_36' of git://github.com/dmonllao/moodle into MOODLE_36_STABLE
This commit is contained in:
@@ -257,11 +257,6 @@ class course_dropout extends \core_analytics\local\target\binary {
|
||||
*/
|
||||
protected function calculate_sample($sampleid, \core_analytics\analysable $course, $starttime = false, $endtime = false) {
|
||||
|
||||
if ($this->enrolment_starts_after_calculation_start($sampleid, $starttime)) {
|
||||
// Discard user enrolments whose start date is after $starttime.
|
||||
return null;
|
||||
}
|
||||
|
||||
$userenrol = $this->retrieve('user_enrolments', $sampleid);
|
||||
|
||||
// We use completion as a success metric only when it is enabled.
|
||||
@@ -290,25 +285,4 @@ class course_dropout extends \core_analytics\local\target\binary {
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Does the user enrolment created after this time range start time or starts after it?
|
||||
*
|
||||
* We need to identify these enrolments because the indicators can not be calculated properly
|
||||
* if the student enrolment started half way through this time range.
|
||||
*
|
||||
* User enrolments whose end date is before time() have already been discarded in
|
||||
* course_enrolments::is_valid_sample.
|
||||
*
|
||||
* @param int $sampleid
|
||||
* @param int $starttime
|
||||
* @return bool
|
||||
*/
|
||||
protected function enrolment_starts_after_calculation_start(int $sampleid, int $starttime) {
|
||||
$userenrol = $this->retrieve('user_enrolments', $sampleid);
|
||||
if ($userenrol->timestart && $userenrol->timestart > $starttime) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user