From 87f47bec9490581cfc3262cf4b55505f41ca4c84 Mon Sep 17 00:00:00 2001 From: stronk7 Date: Fri, 10 Aug 2007 01:46:17 +0000 Subject: [PATCH] Fixing one SQL that could cause problems with coincidences in the associative array. MDL-10787 Merged from MOODLE_18_STABLE --- mod/survey/lib.php | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/mod/survey/lib.php b/mod/survey/lib.php index 26e3a54965..b7a491f0f4 100644 --- a/mod/survey/lib.php +++ b/mod/survey/lib.php @@ -224,14 +224,13 @@ function survey_get_responses($surveyid, $groupid) { $groupsql = ""; } - return get_records_sql("SELECT MAX(a.time) as time, - u.id, u.firstname, u.lastname, u.picture - FROM {$CFG->prefix}survey_answers a, - {$CFG->prefix}user u $groupsdb - WHERE a.survey = $surveyid - AND a.userid = u.id $groupsql - GROUP BY u.id, u.firstname, u.lastname, u.picture - ORDER BY time ASC"); + return get_records_sql("SELECT u.id, u.firstname, u.lastname, u.picture, MAX(a.time) as time + FROM {$CFG->prefix}survey_answers a, + {$CFG->prefix}user u $groupsdb + WHERE a.survey = $surveyid + AND a.userid = u.id $groupsql + GROUP BY u.id, u.firstname, u.lastname, u.picture + ORDER BY time ASC"); } function survey_get_analysis($survey, $user) { -- 2.39.5