"Error reading from database" when sorting feedback by Groups

"Error reading from database" when sorting feedback by Groups

by Rob Robertson -
Number of replies: 4

Under "show responses" for a feedback section, if I click "Groups" (which I assumed would sort by groups), it gives me a "Error reading from database". How can I find out the exact failing query in order to post it here? (Or how can I just fix this, since now I can't see the feedback from 2 feedback sections on my site.)

Average of ratings: -
In reply to Rob Robertson

Re: "Error reading from database" when sorting feedback by Groups

by Daniel Dubbeldam -
I have the same issue....

I managed to trace it back to this query (in my case, might be different, because of the arraysmile
SELECT
c.id, c.timemodified as completed_timemodified, c.courseid, u.id AS userid,u.picture,u.firstname,u.lastname,u.firstnamephonetic,u.lastnamephonetic,u.middlename,u.alternatename,u.imagealt,u.email, v23.value AS val23, v25.value AS val25, v27.value AS val27
FROM mdl_feedback_completed c JOIN mdl_user u ON u.id = c.userid AND u.deleted = ? LEFT OUTER JOIN mdl_feedback_value v23 ON v23.completed = c.id AND v23.item = ? LEFT OUTER JOIN mdl_feedback_value v25 ON v25.completed = c.id AND v25.item = ? LEFT OUTER JOIN mdl_feedback_value v27 ON v27.completed = c.id AND v27.item = ?
WHERE c.anonymous_response = ?
AND c.feedback = ?
ORDER BY groups DESC, lastname DESC
[array (
0 => 0,
1 => '23',
2 => '25',
3 => '27',
4 => 2,
5 => '5',
)]

which traces back to this query in the DB:

SELECT
c.id,
c.timemodified as completed_timemodified,
c.courseid,
u.id AS userid,
u.picture,
u.firstname,
u.lastname,
u.firstnamephonetic,
u.lastnamephonetic,
u.middlename,
u.alternatename,
u.imagealt,
u.email,
v23.value AS val23,
v25.value AS val25,
v27.value AS val27

FROM mdl_feedback_completed c
JOIN mdl_user u ON u.id = c.userid
AND u.deleted = 0
LEFT OUTER JOIN mdl_feedback_value v23 ON v23.completed = c.id
AND v23.item = 23
LEFT OUTER JOIN mdl_feedback_value v25 ON v25.completed = c.id
AND v25.item = 23
LEFT OUTER JOIN mdl_feedback_value v27 ON v27.completed = c.id
AND v27.item = 27
WHERE c.anonymous_response = 2
AND c.feedback = 5
ORDER BY groups DESC, lastname DESC

although it SHOWS the groups on the respondents page, it does NOT show groups in the DB Query, and that's strange...

hopefully this might be a bit helpfull for people to solve the issue....
(Rob, is there already a tracker issue for this problem? can you create /link it?
In reply to Daniel Dubbeldam

Re: "Error reading from database" when sorting feedback by Groups

by Andreas Grabs -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers Picture of Translators

Hi,

can you give me some steps to reproduce this error?
What moodle version do you have?

Thank you
Andreas

In reply to Andreas Grabs

Re: "Error reading from database" when sorting feedback by Groups

by Vladimir Morales -

Hi,

I will respond on behalf of Daniel Dubbeldam.

The issue is spotted on moodle 3.7.2  (build: 20190909) and 3.7.4 (build: 20200113) as well.

The error is shown when  you go to Show responses and then click on  sort by group.

 The link look like this : https://XXXXXX/mod/feedback/show_entries.php?id=XXX&tsort=groups&tdir-

I also added a screenshot as attachment.  




 

Attachment Selection_074.png