Rendering a large number of questions may be quite slow, so we want to
raise the limit.
We don’t call raise() in the loop because the quiz buffer captures this
function for a AJAX script, and we should only call raise if we expect
a corresponding output to the users browser. This helps to prevent
unexpected load balancer disconnects. See core_php_time_limit::raise()
for more details.
There are several improvements over what we had before:
1. We track all the questions seen in the the student's previous
quiz attempts, so that when they start a new quiz attempt, they get
questions they have not seen before if possible.
2. When there are no more unseen questions, we start repeating, but
always taking from the questions with the fewest attempts so far.
3. A similar logic is applied with variants within one question.
There is lots of credit to go around here. Oleg Sychev's students Alex
Shkarupa, Sergei Bastrykin and Darya Beda all worked on this over
several years, helping to clarify the problem and shape the best
solution. In the end, their various attempts were rewritten into this
final patch by me.
This commit is actually the joint work of Mahmoud Kassaei, Colin
Chambers and Tim Hunt from The Open University. We could only use one
persons name for the commit, and this time Colin gets the credit/blame.
The goal of this work was to increase usability, and also clean up
the page enough that it will be possible to add new features in future.
Display of mod/quiz/edit.php is now entirely generated by
mod_quiz\output\edit_renderer. This uses a helper class
mod_quiz\structure to provide details of the structure of the quiz, and
mod_quiz\repaginate to alter that structure. (Acutally, there are still
some modification methods on mod_quiz\structure. Expect that to be
cleaned up in future.)
The new code uses much more ajax, and there are new scripts
mod/quiz/edit_rest.php and mod/quiz/repaginate.php to handle this.
(Again, don't be surprised if those two scripts get merged in future.)
Also questionbank.ajax.php (which may, in future, be made more generic,
and moved into the core question bank code.)
Most of the new JavaScript code has intentionally copied the way things
are done when editing activities on the course page.
As a result of this, mod/quiz/editlib.php is now much shorter than it
was. (In future, expect the remaining code in here to move into
mod/quiz/classes.)
Allows plugins to add columns to the question bank view by extending core_question\bank\column_base
Columns to display are set in $CFG->questionbankcolumns. Columns are namespaced and autoloaded to support this.
Add new API for filtering questions, refactoring the options to display
old questions and include subcategories into new
question_bank_search_condition classes. Make the new API pluggable via
local_[pluginname]_get_question_bank_search_conditions.
quiz_question_statistics_stats renamed to question_statistics_calculator
separate class question_statistics used to store calculated stats
and api changed, also code generally cleaned up.
quiz_question_statistics_stats renamed to question_statistics_calculator
separate class question_statistics used to store calculated stats
and api changed, also code generally cleaned up.