Posts made by Tim Hunt

Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers
There should be an explanation at https://docs.moodle.org/dev/Quiz_statistics_calculations, but currently equation rendering is broken there, which makes the page not very helpful. (MDLSITE-8046).

The code that computes the statistics is spread over various classes, but if you want to look, https://github.com/moodle/moodle/blob/3e73c33f9920fbb066f2c554fb998af46d4706d8/question/classes/statistics/questions/calculator.php#L37 is probably a reasonable place to start. (And, how that is called from mod/quiz/report/statistics code.)
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers
I think you are seeing an after-effect of MDL-82772, which has now been fixed. At any rate, the error is arising becuase the random questions are messed up and pointing to a category that no longer exists. The fact that displaying this outputs erros is really a sympton, but the but is how did it get like that?

If you can still reproduce this, please let us know the exact steps so we can fix it.
Average of ratings: Useful (1)
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers
This definitely should not be happening. The values in the questionid column of the question_versions table should be unique. (Why doesn't the DB schema enforce this? I created MDL-85197.)

In the cases where you have several rows in question_versions with the questionid, which questions are those? can deduce how it got like that?