-
Bug
-
Resolution: Fixed
-
Minor
-
4.0.9, 4.1.4, 4.1.6, 4.2.1, 4.2.7, 4.3.4
-
MOODLE_400_STABLE, MOODLE_401_STABLE, MOODLE_402_STABLE, MOODLE_403_STABLE
-
MOODLE_402_STABLE, MOODLE_403_STABLE
-
MDL-78547_403 -
This issue comes from this forum thread, and other similar ones. At the moment, users get the following confusing experience:
- Create a quiz and add questions.
- Preview the quiz, and answer some things.
- Notice a mistake in one question.
- Click the edit link provided, and fix the problem with the question.
- Save changes and get back to the quiz preview.
- Get confused because the edit they just made is not visible
(Why? becuase the preview is still referring to the previous version of question, even though a later version now exists.)
MDL-77745 should help the situation, by giving some clue about what is going on with the question versions. However, that does not really solve the problem. We are violating the "Don't make me think" UX principle. I can think of two possibilities only one workable possiblity:
Simple and crude: in somewhere like mod/quiz/attempt.php, if the current attempt is a preview, the call some logic to see if any question that should appear in this quiz attempt has been edited, and if so, restart the entire preview (as if re-start preview had been clicked. That is, delete the current preview, and redirect to startattempt.php to create a new one, with a notifcation message to say that the preview was re-started because one or more questoins had been edited).- More nuanced: it should be possible to just re-start the attempts at the questions that have been edited, without destroying the entire preview. This would be a bit harder to code, but might be a better user experience. (For example, if the quiz uses random selection of questoins, then completely recreating the preview would select different questions, which would be very confusing. Right, so we have to do this Option 2.) This code probably lives in mod/quiz/attempt.php, and starts with a call $attemptobj->update_outdated_questions_in_preview();
Thoughts about implementation of that:
The code to work out if a question has changed in a way that affects the current attempt exists in get_new_question_for_regrade in mod/quiz/report/overview/report.php, but that just does one question at a time. We should try to do that efficitly for all questions in the quiz attempt, which means the logic should probably live in the structure or qbank_helper classes.
question_usage_by_activity::add_question_in_place_of_other is similar to what we need to implement this change, but we need something different, say a new question_usage_by_activity::replace_question_attempt. Before replaing the old attempt completely, we coudl first try doing a regrade, to preseve any respones, and only do a replace if that is not possible because the questoin has been edited too much.