Skip to content

Commit

Permalink
Merge branch 'MDL-80341_403' of https://github.com/timhunt/moodle int…
Browse files Browse the repository at this point in the history
…o MOODLE_403_STABLE
  • Loading branch information
HuongNV13 committed Dec 7, 2023
2 parents 7be05aa + 17fb4af commit 419d7f4
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
3 changes: 3 additions & 0 deletions mod/quiz/classes/quiz_attempt.php
Expand Up @@ -2324,6 +2324,9 @@ public function set_offline_modified_time($time) {
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++;
Expand Down
4 changes: 3 additions & 1 deletion mod/quiz/tests/attempt_walkthrough_test.php
Expand Up @@ -61,11 +61,13 @@ public function test_quiz_attempt_walkthrough() {
$saq = $questiongenerator->create_question('shortanswer', null, ['category' => $cat->id]);
$numq = $questiongenerator->create_question('numerical', null, ['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();
Expand All @@ -80,7 +82,7 @@ public function test_quiz_attempt_walkthrough() {
$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);

Expand Down

0 comments on commit 419d7f4

Please sign in to comment.