Because of the way votes are written in the database, an entry of
survey_votes can be associated with 0 survey_answers entries. Using
a LEFT JOIN in this case is buggy because it generates NULL entries that
are not supported by the processing code.
Closes #1214
Signed-off-by: Florent Bruneau <florent.bruneau@polytechnique.org>
}
$sql = 'SELECT v.id AS vid, a.question_id AS qid, a.answer AS answer
FROM survey_votes AS v
- LEFT JOIN survey_answers AS a
- ON a.vote_id=v.id
+ INNER JOIN survey_answers AS a ON a.vote_id=v.id
WHERE v.survey_id={?}
- ORDER BY vid ASC, qid ASC, answer ASC;';
+ ORDER BY vid ASC, qid ASC, answer ASC';
$res = XDB::iterator($sql, $this->id); // retrieves all answers from database
$vid = -1;
$vid_ = 0;