Error while clicking on quiz

Error while clicking on quiz

by Janvi MDL -
Number of replies: 3

Hello folks,

I have around 25 courses in my site all were working good few days back. I work with Moodle 3.9. I started tracing an error when I access quiz. 

error 

Any help regarding this issue will be appreciated.

Regards,

Janvi

Average of ratings: -
In reply to Janvi MDL

Re: Error while clicking on quiz

by ali moos -
hi
Did you update the moodle to version 3.9? And if yes, the previous quizzes have this error or the ones you created new? If not, did you not make any special changes this time?
In reply to Janvi MDL

Re: Error while clicking on quiz

by Tim Hunt -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers
Looking at that stack trace, this error is coming form the gradebook.

Moodle is trying to load something (a grade item) from the database, and is finding two matching records when it is expecting to find one. That is going to take some debugging to work out.

If you can access the database then examining the output of

SELECT * FROM mdl_grade_items WHERE courseid = ...

might give some info about what is happening. (Don't know what could have caused your site to get into this state.)
In reply to Tim Hunt

Re: Error while clicking on quiz

by Janvi MDL -
Hello Tim,

Even I expected the same. I could fire some queries listed below :

select courseid, count(*) from mdl_grade_items where itemtype = 'course' group by courseid having count(*) > 1;

select * from mdl_grade_categories where courseid in (select courseid from mdl_grade_items where itemtype = 'course' group by courseid having count(*) > 1);

I could find duplicate records in mdl_grade_items and mdl_grade_categories.

Can you kindly guide me to proceed further?