Skip to content

Commit

Permalink
Fixing one SQL that could cause problems with coincidences
Browse files Browse the repository at this point in the history
in the associative array. MDL-10787

Merged from MOODLE_18_STABLE
  • Loading branch information
stronk7 committed Aug 10, 2007
1 parent 8207a81 commit 87f47be
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions mod/survey/lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 87f47be

Please sign in to comment.