Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

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

(from Petri Asikainen)
  • Loading branch information...
commit 734d2c988764641f324302df409ccce4032999a4 1 parent 2f05b46
authored February 17, 2003

Showing 1 changed file with 5 additions and 3 deletions. Show diff stats Hide diff stats

  1. 8  mod/survey/lib.php
8  mod/survey/lib.php
@@ -145,14 +145,16 @@ function survey_log_info($log) {
145 145
 
146 146
 function survey_get_responses($survey) {
147 147
     global $CFG;
148  
-    return get_records_sql("SELECT a.time as time, count(*) as numanswers, u.*
  148
+    return get_records_sql("SELECT MAX(a.time) as time, 
  149
+                                   count(*) as numanswers, 
  150
+                                   u.id, u.firstname, u.lastname
149 151
                               FROM {$CFG->prefix}survey_answers AS a, 
150 152
                                    {$CFG->prefix}user AS u
151 153
                              WHERE a.answer1 <> '0' AND a.answer2 <> '0'
152 154
                                    AND a.survey = $survey 
153 155
                                    AND a.userid = u.id
154  
-                          GROUP BY a.userid 
155  
-                          ORDER BY a.time ASC");
  156
+                          GROUP BY u.id, u.firstname, u.lastname
  157
+                          ORDER BY time ASC");
156 158
 }
157 159
 
158 160
 function survey_get_analysis($survey, $user) {

0 notes on commit 734d2c9

Please sign in to comment.
Something went wrong with that request. Please try again.