mirror of
https://github.com/moodle/moodle.git
synced 2025-03-28 11:32:42 +01:00
Merge branch 'MDL-77210_401' of https://github.com/timhunt/moodle into MOODLE_401_STABLE
This commit is contained in:
commit
f559c0ad59
mod/quiz
@ -419,7 +419,6 @@ class quiz_overview_report extends quiz_attempts_report {
|
||||
*/
|
||||
protected function get_new_question_for_regrade(stdClass $attempt,
|
||||
question_usage_by_activity $quba, int $slot): question_definition {
|
||||
global $DB;
|
||||
|
||||
// If the cache is empty, get information about all the slots.
|
||||
if ($this->structureforregrade === null) {
|
||||
@ -429,14 +428,17 @@ class quiz_overview_report extends quiz_attempts_report {
|
||||
$attempt->quiz, $this->context);
|
||||
}
|
||||
|
||||
// Because of 'Redo question in attempt' feature, we need to find the original slot number.
|
||||
$originalslot = $quba->get_question_attempt_metadata($slot, 'originalslot') ?? $slot;
|
||||
|
||||
// If this is a non-random slot, we will have the right info cached.
|
||||
if ($this->structureforregrade[$slot]->qtype != 'random') {
|
||||
if ($this->structureforregrade[$originalslot]->qtype != 'random') {
|
||||
// This is a non-random slot.
|
||||
return question_bank::load_question($this->structureforregrade[$slot]->questionid);
|
||||
return question_bank::load_question($this->structureforregrade[$originalslot]->questionid);
|
||||
}
|
||||
|
||||
// We must be dealing with a random question. Check that cache.
|
||||
$currentquestion = $quba->get_question_attempt($slot)->get_question(false);
|
||||
$currentquestion = $quba->get_question_attempt($originalslot)->get_question(false);
|
||||
if (isset($this->newquestionidsforold[$currentquestion->id])) {
|
||||
return question_bank::load_question($this->newquestionidsforold[$currentquestion->id]);
|
||||
}
|
||||
|
@ -43,6 +43,19 @@ Feature: Allow students to redo questions in a practice quiz, without starting a
|
||||
Then the state of "First question" question is shown as "Not complete"
|
||||
And I should see "Marked out of 2.00" in the "First question" "question"
|
||||
|
||||
@javascript
|
||||
Scenario: After redoing a question, regrade works
|
||||
Given I am on the "Quiz 1" "mod_quiz > View" page logged in as "student"
|
||||
When I press "Attempt quiz"
|
||||
And I click on "False" "radio" in the "First question" "question"
|
||||
And I click on "Check" "button" in the "First question" "question"
|
||||
And I press "Try another question like this one"
|
||||
And I am on the "Quiz 1" "mod_quiz > Grades report" page logged in as "teacher"
|
||||
And I press "Regrade all"
|
||||
Then I should see "Finished regrading (1/1)"
|
||||
And I should see "Regrade completed"
|
||||
And I press "Continue"
|
||||
|
||||
@javascript
|
||||
Scenario: Start attempt, teacher edits question, redo picks up latest non-draft version
|
||||
# Start attempt as student.
|
||||
|
Loading…
x
Reference in New Issue
Block a user