Skip to content

Commit

Permalink
MDL-46987 report_participation: Count duplicate logs as 1
Browse files Browse the repository at this point in the history
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
  • Loading branch information
Rajesh Taneja committed Sep 22, 2014
1 parent 8152e9f commit 6edd1ef
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions report/participation/index.php
Expand Up @@ -265,7 +265,7 @@

// 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
Expand All @@ -278,7 +278,8 @@
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;
Expand Down

0 comments on commit 6edd1ef

Please sign in to comment.