Correct use of the question_usages DB table

Re: Correct use of the question_usages DB table

by Tim Hunt -
Number of replies: 3
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers
Actually, there may be a quick and dirty way to improve things just by changing the core question engine.

At the moment, we fully initialise each question when the question_attempt is loaded (https://github.com/moodle/moodle/blob/master/question/engine/questionattempt.php#L1557).

We could change that to a lazy-load. So that the question is only initialised using $question->apply_attempt_state the first time that a method that requires the question to be fully initialised is called.

It would just be a matter of analysing all the methods of question_attempt to work out which need an initialised question. And then hoping that our automated tests are good enough to catch any mistakes made.

Moodle 3.8 is in the final stages of release, so it is not the time to make a risky change like this. The soonest it could be done is for Moodle 3.9.

I am not sure if this would help the standard quiz module. I wonder if rendering the Quiz navigation UI needs enough details about the question that it has to be initialised? But, for other activity modules, this could be a useful change.

(Edit: filed as MDL-67183.)


In reply to Tim Hunt

Re: Correct use of the question_usages DB table

by George Schaathun -
Picture of Plugin developers

I see patch has been made on MDL-67183.  Is it realistic to hope for it to be merged into the stable 3.8 branch before next semester starts in August?  And in the new 3.9 release when it comes?

I am seriously considering to use MDL-67183 branch head for my class starting in August, just to get around this problem, but if there are alternatives ... 

In reply to George Schaathun

Re: Correct use of the question_usages DB table

by Tim Hunt -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers
The code was submitted before the deadline. I have been reassured that everything submitted will get reviewed and integrated before 3.9 is released.

You can track integration progress on the dashboard here: https://tracker.moodle.org/secure/Dashboard.jspa?selectPageId=11350. On deadline day, the integration pile (mountain) was at 100, and it is now down to 70 - and this is with them tackling the biggest, most compliated, and difficult to integrate things first.