MDL-6340 quiz: avoid reusing random questions between attempts

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 contained in:
Tim Hunt
2015-03-26 17:45:49 +00:00
parent 20d38830ae
commit bb93fc24aa
16 changed files with 1158 additions and 153 deletions
+3 -2
View File
@@ -486,14 +486,15 @@ class question_usage_by_activity {
* @param int $variant which variant of the question to use. Must be between
* 1 and ->get_num_variants($slot) inclusive. If not give, a variant is
* chosen at random.
* @param int $timestamp optional, the timstamp to record for this action. Defaults to now.
*/
public function start_question($slot, $variant = null) {
public function start_question($slot, $variant = null, $timenow = null) {
if (is_null($variant)) {
$variant = rand(1, $this->get_num_variants($slot));
}
$qa = $this->get_question_attempt($slot);
$qa->start($this->preferredbehaviour, $variant);
$qa->start($this->preferredbehaviour, $variant, array(), $timenow);
$this->observer->notify_attempt_modified($qa);
}