MDL-65630 mod_quiz: Allow redo within an attempt with random questions

This commit is contained in:
Shamim Rezaie 2019-05-20 22:56:57 +10:00
parent 2e68255609
commit 80c360d573
2 changed files with 21 additions and 1 deletions

View file

@ -588,7 +588,7 @@ class quiz_attempt {
$this->quba = question_engine::load_questions_usage_by_activity($this->attempt->uniqueid);
$this->slots = $DB->get_records('quiz_slots',
array('quizid' => $this->get_quizid()), 'slot',
'slot, requireprevious, questionid, includingsubcategories');
'slot, id, requireprevious, questionid, includingsubcategories');
$this->sections = array_values($DB->get_records('quiz_sections',
array('quizid' => $this->get_quizid()), 'firstslot'));

View file

@ -116,3 +116,23 @@ Feature: Allow students to redo questions in a practice quiz, without starting a
And I press "Try another question like this one"
And I click on "Check" "button" in the "Second question" "question"
Then the state of "Second question" question is shown as "Correct"
@javascript
Scenario: Redoing questions should work with random questions as well
Given the following "questions" exist:
| questioncategory | qtype | name | questiontext |
| Test questions | random | Random (Test questions) | 0 |
And the following "activities" exist:
| activity | name | intro | course | idnumber | preferredbehaviour | canredoquestions |
| quiz | Quiz 2 | Quiz 2 description | C1 | quiz2 | immediatefeedback | 1 |
And quiz "Quiz 2" contains the following questions:
| question | page |
| Random (Test questions) | 1 |
And I log in as "student"
And I am on "Course 1" course homepage
When I follow "Quiz 2"
And I press "Attempt quiz now"
And I click on "False" "radio"
And I click on "Check" "button"
And I press "Try another question like this one"
Then "Check" "button" should exist