Sorry to insist but this bug is a real blocker for my day-to-day use of moodle. Can someone please come up with a quick fix?
The sql query in moodle 1.8 was much more complicated but it worked fine. Here is an example:
SELECT DISTINCT prs.userid, u.firstname,u.lastname,u.idnumber,count(l.action) as count FROM (SELECT ra.userid, ra.roleid AS primary_roleid, ra.contextid, r.sortorder, r.name, r.description, r.shortname, c.instanceid AS courseid, c.contextlevel FROM mdl_role_assignments ra INNER JOIN mdl_role r ON ra.roleid = r.id INNER JOIN mdl_context c ON ra.contextid = c.id WHERE NOT EXISTS ( SELECT 1 FROM mdl_role_assignments i_ra INNER JOIN mdl_role i_r ON i_ra.roleid = i_r.id WHERE ra.userid = i_ra.userid AND ra.contextid = i_ra.contextid AND i_r.sortorder < r.sortorder ) ) prs JOIN mdl_user u ON u.id = prs.userid LEFT JOIN mdl_log l ON prs.userid = l.userid AND prs.courseid = l.course AND l.time > 0 AND l.course = 2 AND l.module = 'quiz' AND l.cmid = 27 AND action IN ('view','view all','report','attempt','editquestions','review','submit' ) WHERE prs.courseid = 2 AND prs.primary_roleid = 5 AND prs.contextlevel = 50 AND prs.courseid = 2 GROUP BY prs.userid,u.firstname,u.lastname,u.idnumber,l.userid ORDER BY lastname ASC
The sql query in moodle 1.9 is much shorter but does not work satisfactorily; e.g.:
SELECT ra.userid, u.firstname, u.lastname, u.idnumber, COUNT(l.action) AS count FROM mdl_role_assignments ra JOIN mdl_user u ON u.id = ra.userid LEFT OUTER JOIN mdl_log l ON l.userid = ra.userid WHERE ra.contextid IN (10,3,1) AND ra.roleid = 5 AND (l.id IS NULL OR (l.cmid = 27 AND l.time > 0 AND l.action IN ('view','view all','report','attempt','editquestions','review','submit' )) ) AND prs.courseid = 2 GROUP BY ra.userid, u.firstname, u.lastname, u.idnumber ORDER BY lastname ASC
Waiting eagerly for the solution,
Joseph
I have the same issue. A friend of mine (PHP expert but not a Moodle user) had a look at it and came up with a theory. Here's a copy/paste of the info I posted in the moodle forum
Ok, here I am with, I hope, some clues as to where the problem may be situated. A friend of mine who is pretty good at PHP (but who doesn't use Moodle) had a quick look at the query and came up with the following suggestion (I am no techie, so I'll try and be as clear as I can)
What follows will be understandable to our developers, I hope..
My friend thinks the query gets too much info. If I'm not mistaken, normally the query for participation report says that if it can't find any logs of the student in the context of the activity, it will return NULL:true the line is:
AND
(l.id IS NULL
However, it seems to take into account actions that are situated outside the course, like just logging in to the Moodle site, so the NULL value is never true, so it can't display the "no" students.
I tested his hypothesis this way:
On my test platform, I created 4 students and did the following things:
When I do a "participation report", this is what I get:
2 student
Student 04: No (never logged in to the platform)
Student 01: Yes (1) (logged in and did the activity)
My conclusion would be that the query seems to consider that just logging in to the platform is logged, obviously, but the query doesn't return NULL:True as it seems to take into account the student's logging in on the Moodle site. On the other hand, it can't display the others (Student02 and 03) as "Yes" as they haven't done the activity. As the query can't display them as "Yes" but can't display them as "no" (as the result is not NULL:true) it just ignores them...
I hope I was clear enough in the explanation... My friend doesn't really have the time to look into the problem further, and I'm only starting to understand php...
I'd be happy to provide more info or clear things up, if I can...
JL Delghust
- Student01: logged in to the course and did the activity
- Student02: logged in to the course but didn't do the activity
- Student03: was added manually to the students of the course, logged in on the platform but not to the course.
- Student04: was added manually to the platform but never logged in at all.
When I do a "participation report", this is what I get: 2 student Student 04: No (never logged in to the platform) Student 01: Yes (1) (logged in and did the activity) My conclusion would be that the query seems to consider that just logging in to the platform is logged, obviously, but the query doesn't return NULL:True as it seems to take into account the student's logging in on the Moodle site. On the other hand, it can't display the others (Student02 and 03) as "Yes" as they haven't done the activity. As the query can't display them as "Yes" but can't display them as "no" (as the result is not NULL:true) it just ignores them... I hope I was clear enough in the explanation... My friend doesn't really have the time to look into the problem further, and I'm only starting to understand php... I'd be happy to provide more info or clear things up, if I can... JL Delghust