Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
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.
Comment | File | Size | Author |
---|---|---|---|
#5 | questions_not_marked_as-2860343-5.patch | 1.46 KB | djdevin |
| |||
#2 | quiz-mark_unanswered_questions_as_skipped-2860343-2.patch | 1.23 KB | OliverColeman |
|
Comments
Comment #2
OliverColeman CreditAttribution: OliverColeman commentedPatch that changes the behaviour of quiz_end_scoring() to mark QRAs with empty timestamp as skipped.
Comment #3
djdevinSure, let's see how the tests do.
Comment #4
Da_Cloud CreditAttribution: Da_Cloud at INDICIA commentedTested 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.
Comment #5
djdevinI rerolled with the suggestions, this looks good.
That old code may have been there before we stored the question layout on attempt creation.
Comment #7
djdevinThanks. Fixed!