mirror of
https://github.com/moodle/moodle.git
synced 2025-03-01 14:32:48 +01:00
MDL-80341 quiz: unseen descriptions are not unanswered questonis
This was causing confusing in the 'are you sure you want to submit' confirmation pop-up.
This commit is contained in:
parent
76ff7600e4
commit
579a5061ef
@ -2726,6 +2726,9 @@ class quiz_attempt {
|
||||
public function get_number_of_unanswered_questions(): int {
|
||||
$totalunanswered = 0;
|
||||
foreach ($this->get_slots() as $slot) {
|
||||
if (!$this->is_real_question($slot)) {
|
||||
continue;
|
||||
}
|
||||
$questionstate = $this->get_question_state($slot);
|
||||
if ($questionstate == question_state::$todo || $questionstate == question_state::$invalid) {
|
||||
$totalunanswered++;
|
||||
|
@ -59,11 +59,13 @@ class attempt_walkthrough_test extends \advanced_testcase {
|
||||
$saq = $questiongenerator->create_question('shortanswer', null, array('category' => $cat->id));
|
||||
$numq = $questiongenerator->create_question('numerical', null, array('category' => $cat->id));
|
||||
$matchq = $questiongenerator->create_question('match', null, ['category' => $cat->id]);
|
||||
$description = $questiongenerator->create_question('description', null, ['category' => $cat->id]);
|
||||
|
||||
// Add them to the quiz.
|
||||
quiz_add_quiz_question($saq->id, $quiz);
|
||||
quiz_add_quiz_question($numq->id, $quiz);
|
||||
quiz_add_quiz_question($matchq->id, $quiz);
|
||||
quiz_add_quiz_question($description->id, $quiz);
|
||||
|
||||
// Make a user to do the quiz.
|
||||
$user1 = $this->getDataGenerator()->create_user();
|
||||
@ -78,7 +80,7 @@ class attempt_walkthrough_test extends \advanced_testcase {
|
||||
$attempt = quiz_create_attempt($quizobj, 1, false, $timenow, false, $user1->id);
|
||||
|
||||
quiz_start_new_attempt($quizobj, $quba, $attempt, 1, $timenow);
|
||||
$this->assertEquals('1,2,3,0', $attempt->layout);
|
||||
$this->assertEquals('1,2,3,4,0', $attempt->layout);
|
||||
|
||||
quiz_attempt_save_started($quizobj, $quba, $attempt);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user