middlebury/moodle-mod_adaptivequiz

Error fetching question from the database

Closed this issue · 1 comments

When "start attempt" is clicked, the course throws the following error:

Debug info: ERROR: column "u.id" must appear in the GROUP BY clause or be used in an aggregate function
LINE 1: SELECT u.id, u.firstname, u.lastname, u.email, a.highestleve...
^
SELECT u.id, u.firstname, u.lastname, u.email, a.highestlevel, a.lowestlevel,
(SELECT COUNT(*)
FROM mdl_adaptivequiz_attempt caa
WHERE caa.userid = u.id
AND caa.instance = aa.instance
) AS attempts,
(SELECT maa.measure
FROM mdl_adaptivequiz_attempt maa
WHERE maa.instance = a.id
AND maa.userid = u.id
AND maa.attemptstate = $1
AND maa.standarderror > 0.0
ORDER BY measure DESC
LIMIT 1) AS measure,
(SELECT saa.standarderror
FROM mdl_adaptivequiz_attempt saa
WHERE saa.instance = a.id
AND saa.userid = u.id
AND saa.attemptstate = $2
AND saa.standarderror > 0.0
ORDER BY measure DESC
LIMIT 1) AS stderror,
(SELECT taa.timemodified
FROM mdl_adaptivequiz_attempt taa
WHERE taa.instance = a.id
AND taa.userid = u.id
AND taa.attemptstate = $3
AND taa.standarderror > 0.0
ORDER BY measure DESC
LIMIT 1) AS timemodified,
(SELECT iaa.uniqueid
FROM mdl_adaptivequiz_attempt iaa
WHERE iaa.instance = a.id
AND iaa.userid = u.id
AND iaa.attemptstate = $4
AND iaa.standarderror > 0.0
ORDER BY measure DESC
LIMIT 1) AS uniqueid
FROM mdl_adaptivequiz_attempt aa
JOIN mdl_user u ON u.id = aa.userid
JOIN mdl_adaptivequiz a ON a.id = aa.instance

WHERE aa.instance = $5

GROUP BY aa.userid
ORDER BY lastname ASC LIMIT 30 OFFSET 0
[array (
0 => 'complete',
1 => 'complete',
2 => 'complete',
3 => 'complete',
4 => '2',
)]
Error code: dmlreadexception
Stack trace:

line 443 of /lib/dml/moodle_database.php: dml_read_exception thrown
line 244 of /lib/dml/pgsql_native_moodle_database.php: call to moodle_database->query_end()
line 764 of /lib/dml/pgsql_native_moodle_database.php: call to pgsql_native_moodle_database->query_end()
line 145 of /mod/adaptivequiz/viewreport.php: call to pgsql_native_moodle_database->get_records_sql()

What version of Moodle does this error occur in? I've not been able to replicate this issue, but will reopen with more information. Thanks.