If a quiz is finalized before all the questions have been visited then the questions that have not had the "Leave blank" button pressed for them are not marked as being skipped.

This is because QuizResultController::save creates a quiz_result_answer (QRA) for each question at the beginning of the quiz, but quiz_end_scoring() in quiz.module expects there to be no QRA for skipped questions.

I'll attach a patch that changes the behaviour of quiz_end_scoring() - I'm assuming that it's important that QRAs are created at the beginning of the quiz.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

OliverColeman created an issue. See original summary.

OliverColeman’s picture

Patch that changes the behaviour of quiz_end_scoring() to mark QRAs with empty timestamp as skipped.

djdevin’s picture

Status: Active » Needs review

Sure, let's see how the tests do.

Da_Cloud’s picture

Tested the patch locally and it does what it needs to do.

I can only find 2 minor (nitpicking) issues with it.
1) As far as I can see the patch removes the needs for the $questions variable declaration on line 2051, so it might as well delete it.
$questions = $quiz_result->getLayout();

2) The commend added on line 2059 extends the character limit of 79 and should technically be placed along 2 lines.
// If the result answer has not been marked as skipped and it hasn't been answered.

djdevin’s picture

I rerolled with the suggestions, this looks good.

That old code may have been there before we stored the question layout on attempt creation.

  • djdevin committed dba7050 on 7.x-5.x authored by OliverColeman
    Issue #2860343 by OliverColeman, djdevin, Da_Cloud: Questions not marked...
djdevin’s picture

Status: Needs review » Fixed

Thanks. Fixed!

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.