middlebury/moodle-mod_adaptivequiz

SQL error when clicking the 'View report' button with Moodle 3.0.6

Closed this issue · 0 comments

benIT commented

Hello,
I am encountering an SQL error when viewing a report in adaptive quiz.
Details:

  • Adaptive quiz version: 1.2.3
  • Moodle version: 3.0.6
  • Database: PostgreSQL 9.4.10

Steps to reproduce:

  • Create a course named: "test course for adaptive quiz"

  • Go to the course page

  • Create 3 "true/false" questions with category set to 'Default for test course for adaptive quiz'.
    ` Dashboard / ► Courses / ► test course for adaptive quiz / ► Question bank / ► Questions /

  • According to this answer, question 1 is tagged as "adpq_1", question 2 is tagged as"adpq_2",question 3 tagged as"adpq_3".

  • Get back to course page and click "Add an activity or resource", then add an Adaptive Quiz named "test adaptive quiz".

  • This test will be feed configured as follow:
    -Question pool:'Default for test course for adaptive quiz'.
    -Starting level of difficulty: 1
    -Lowest level of difficulty: 1
    -Highest level of difficulty: 1
    -Minimum number of questions: 1
    -Maximum number of questions: 3
    -Standard Error to stop: 5

  • Go to the 'test course for adaptive quiz' page, and click on the quiz.

  • Click on the 'View Report' button

  • The following error will appear:

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 => '1',
)]
Error code: dmlreadexception