Permalink
Browse files

Fixes to survey_get_responses() to make it work better with PostgreSQL

(from Petri Asikainen)
  • Loading branch information...
1 parent 2f05b46 commit 734d2c988764641f324302df409ccce4032999a4 moodler committed Feb 17, 2003
Showing with 5 additions and 3 deletions.
  1. +5 −3 mod/survey/lib.php
View
8 mod/survey/lib.php
@@ -145,14 +145,16 @@ function survey_log_info($log) {
function survey_get_responses($survey) {
global $CFG;
- return get_records_sql("SELECT a.time as time, count(*) as numanswers, u.*
+ return get_records_sql("SELECT MAX(a.time) as time,
+ count(*) as numanswers,
+ u.id, u.firstname, u.lastname
FROM {$CFG->prefix}survey_answers AS a,
{$CFG->prefix}user AS u
WHERE a.answer1 <> '0' AND a.answer2 <> '0'
AND a.survey = $survey
AND a.userid = u.id
- GROUP BY a.userid
- ORDER BY a.time ASC");
+ GROUP BY u.id, u.firstname, u.lastname
+ ORDER BY time ASC");
}
function survey_get_analysis($survey, $user) {

0 comments on commit 734d2c9

Please sign in to comment.