Clicking the "Leave blank" button sometimes causes an application crash, and the following message appears in the log file:

PDOException: SQLSTATE[HY000]: General error: 1364 Field 'result_id' doesn't have a default value: INSERT INTO {quiz_node_results_answers} (is_correct, is_skipped, points_awarded, answer_timestamp) VALUES (:db_insert_placeholder_0, :db_insert_placeholder_1, :db_insert_placeholder_2, :db_insert_placeholder_3); Array ( [:db_insert_placeholder_0] => 0 [:db_insert_placeholder_1] => 1 [:db_insert_placeholder_2] => 0 [:db_insert_placeholder_3] => 1424631985 ) in drupal_write_record() (line 7239 of /usr/local/share/drupal7/includes/common.inc).

This problem has been observed with both true/false and multiple choice questions, but does not occur 100% of the time.

Comments

djmolny’s picture

Issue summary: View changes
djdevin’s picture

I'm having a hard time reproducing this.

Could you give me the steps, from Quiz set up, to take, that triggers the error?

andrewtur’s picture

I've got the same issue on the aplha 9

djdevin’s picture

Can you tell me how to set it up so that it fails?

The tests do not reproduce this issue so we need exact steps to reproduce in order to fix it.

raycascella’s picture

Version: 7.x-5.0-alpha8 » 7.x-5.x-dev
Status: Active » Needs review
StatusFileSize
new1.71 KB

I've created a patch to fix this issue. It's due to the leave blank form submission function, quiz_question_answering_form_submit_blank, processing the answer attempt without the original question vid when the user first took the quiz.

You can reproduce this way:

1. Create a quiz with some questions and have a user complete the quiz, answering the questions.
2. Edit one or more of questions, and create a new revision.
3. When prompted by the revision check for an action. Select do nothing.
4. Take the quiz again, and when prompted to answer the question your revised, select "Leave Blank"

You should then see the error. If you created the quiz with unlimited attempts, you can take the quiz again with the same user as before to see the error on your new attempt, or use a brand new user.

My fix takes the same question finding logic used when the question is actually answered, quiz_question_answering_form_submit, and uses it in the leave blank call, to keep the proper question vid.

Status: Needs review » Needs work

The last submitted patch, 5: quiz-2431409-05-leaveblankfatal.diff, failed testing.

raycascella’s picture

Status: Needs work » Needs review
StatusFileSize
new4.18 KB

reroll

Status: Needs review » Needs work

The last submitted patch, 7: quiz-2431409-07-leaveblankfatal.diff, failed testing.

raycascella’s picture

Status: Needs work » Needs review
StatusFileSize
new2.03 KB

Status: Needs review » Needs work

The last submitted patch, 9: quiz-2431409-09-leaveblankvidfix.diff, failed testing.

raycascella’s picture

Status: Needs work » Needs review
StatusFileSize
new2.03 KB

Stupid patch creation.

Status: Needs review » Needs work

The last submitted patch, 11: quiz-2431409-11-leaveblankvidfix.diff, failed testing.

raycascella’s picture

Status: Needs work » Needs review
StatusFileSize
new2.03 KB

Status: Needs review » Needs work

The last submitted patch, 13: quiz-2431409-13w-leaveblankvidfix.diff, failed testing.

raycascella’s picture

Status: Needs work » Needs review
StatusFileSize
new2.02 KB

Status: Needs review » Needs work

The last submitted patch, 15: quiz-2431409-15-leave-blank.diff, failed testing.

raycascella’s picture

Status: Needs work » Needs review
StatusFileSize
new2.19 KB

Status: Needs review » Needs work

The last submitted patch, 17: quiz-2431409-15b-leave-blank.diff, failed testing.

djdevin’s picture

Status: Needs work » Needs review
StatusFileSize
new2.23 KB
djdevin’s picture

StatusFileSize
new1.52 KB
new3.75 KB

The last submitted patch, 20: failing-test.patch, failed testing.

  • djdevin committed 6caad44 on 7.x-5.x authored by RayCascella
    Issue #2431409 by RayCascella, djdevin: "Leave blank" causes a crash
    
djdevin’s picture

Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

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