mirror of
https://github.com/moodle/moodle.git
synced 2025-07-25 08:11:39 +02:00
MDL-67119 core_analytics: Analyse users once per course
User's activity in a course should be analysed only once no matter the number of enrolments the user has in that course.
This commit is contained in:
@@ -122,7 +122,7 @@ class student_enrolments extends \core_analytics\local\analyser\by_course {
|
||||
foreach ($enrolments as $userenrolmentid => $user) {
|
||||
|
||||
if (empty($studentids[$user->id])) {
|
||||
// Not a student.
|
||||
// Not a student or an analysed one.
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -147,6 +147,9 @@ class student_enrolments extends \core_analytics\local\analyser\by_course {
|
||||
unset($user->uetimecreated);
|
||||
unset($user->uetimemodified);
|
||||
|
||||
// This student has been already analysed. We analyse each student once.
|
||||
unset($studentids[$user->id]);
|
||||
|
||||
$samplesdata[$sampleid]['course'] = $course->get_course_data();
|
||||
$samplesdata[$sampleid]['context'] = $course->get_context();
|
||||
$samplesdata[$sampleid]['user'] = $user;
|
||||
|
Reference in New Issue
Block a user