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.
| Comment | File | Size | Author |
|---|---|---|---|
| #20 | leave_blank_causes_a-2431409-20.patch | 3.75 KB | djdevin |
| #20 | failing-test.patch | 1.52 KB | djdevin |
Comments
Comment #1
djmolny commentedComment #2
djdevinI'm having a hard time reproducing this.
Could you give me the steps, from Quiz set up, to take, that triggers the error?
Comment #3
andrewtur commentedI've got the same issue on the aplha 9
Comment #4
djdevinCan 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.
Comment #5
raycascellaI'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.
Comment #7
raycascellareroll
Comment #9
raycascellaComment #11
raycascellaStupid patch creation.
Comment #13
raycascellaComment #15
raycascellaComment #17
raycascellaComment #19
djdevinComment #20
djdevinComment #23
djdevin