MDL-25708 recordsets - survey module

This commit is contained in:
Eloy Lafuente (stronk7) 2011-01-14 15:51:53 +01:00
parent 676874df1d
commit a1d870aa95

View File

@ -232,13 +232,15 @@ function survey_print_recent_activity($course, $viewfullnames, $timestart) {
$slist = implode(',', $ids); // there should not be hundreds of glossaries in one course, right?
if (!$rs = $DB->get_recordset_sql("SELECT sa.userid, sa.survey, MAX(sa.time) AS time,
u.firstname, u.lastname, u.email, u.picture
FROM {survey_answers} sa
JOIN {user} u ON u.id = sa.userid
WHERE sa.survey IN ($slist) AND sa.time > ?
GROUP BY sa.userid, sa.survey, u.firstname, u.lastname, u.email, u.picture
ORDER BY time ASC", array($timestart))) {
$rs = $DB->get_recordset_sql("SELECT sa.userid, sa.survey, MAX(sa.time) AS time,
u.firstname, u.lastname, u.email, u.picture
FROM {survey_answers} sa
JOIN {user} u ON u.id = sa.userid
WHERE sa.survey IN ($slist) AND sa.time > ?
GROUP BY sa.userid, sa.survey, u.firstname, u.lastname, u.email, u.picture
ORDER BY time ASC", array($timestart));
if (!$rs->valid()) {
$rs->close(); // Not going to iterate (but exit), close rs
return false;
}