Permalink
Browse files

MDL-35175 - Lesson shows no attempts if associated with a grouping

  • Loading branch information...
1 parent f29e62c commit 334c6d805f995b1640377fdd143073e99c435531 @rlorenzo rlorenzo committed Jan 16, 2013
Showing with 4 additions and 3 deletions.
  1. +4 −3 mod/lesson/report.php
View
@@ -47,13 +47,14 @@
$params = array_merge($params, $sortparams);
// TODO: Improve this. Fetching all students always is crazy!
if (!empty($cm->groupingid)) {
- $params["groupid"] = $cm->groupingid;
+ $params["groupingid"] = $cm->groupingid;
$sql = "SELECT DISTINCT $ufields
FROM {lesson_attempts} a
INNER JOIN {user} u ON u.id = a.userid
INNER JOIN {groups_members} gm ON gm.userid = u.id
- INNER JOIN {groupings_groups} gg ON gm.groupid = :groupid
- WHERE a.lessonid = :lessonid
+ INNER JOIN {groupings_groups} gg ON gm.groupid = gg.groupid
+ WHERE a.lessonid = :lessonid AND
+ gg.groupingid = :groupingid
ORDER BY $sort";
} else {
$sql = "SELECT DISTINCT $ufields

0 comments on commit 334c6d8

Please sign in to comment.