From 6edd1ef671703f10c51d89f7344c5695e74b7dbd Mon Sep 17 00:00:00 2001 From: Rajesh Taneja Date: Mon, 18 Aug 2014 16:33:19 +0800 Subject: [PATCH] MDL-46987 report_participation: Count duplicate logs as 1 Some of the actions generate more then 1 event. Example: forum post create generate: - post_created and - accessible_uploaded events which gets logged at the same time. Count them as 1 action and not 2, as it is single action and report should show 1 and not 2 --- report/participation/index.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/report/participation/index.php b/report/participation/index.php index 789d18119b7..af8334e3dd7 100644 --- a/report/participation/index.php +++ b/report/participation/index.php @@ -265,7 +265,7 @@ if (!empty($instanceid) && !empty($roleid)) { // Get record from sql_internal_reader and merge with records got from legacy log (if needed). if (!$onlyuselegacyreader) { - $sql = "SELECT ra.userid, $usernamefields, u.idnumber, l.actioncount AS count + $sql = "SELECT ra.userid, $usernamefields, u.idnumber, COUNT(l.actioncount) AS count FROM (SELECT DISTINCT userid FROM {role_assignments} WHERE contextid $relatedctxsql AND roleid = :roleid ) ra JOIN {user} u ON u.id = ra.userid $groupsql @@ -278,7 +278,8 @@ if (!empty($instanceid) && !empty($roleid)) { AND anonymous = 0 AND contextlevel = :contextlevel AND (origin = 'web' OR origin = 'ws') - GROUP BY userid) l ON (l.userid = ra.userid)"; + GROUP BY userid,timecreated) l ON (l.userid = ra.userid) + GROUP BY ra.userid, $usernamefields, u.idnumber"; $params['edulevel'] = core\event\base::LEVEL_PARTICIPATING; $params['contextlevel'] = CONTEXT_MODULE; -- 2.11.4.GIT