Closed (fixed)
Project:
Quiz
Version:
7.x-4.0-alpha4
Component:
Code - Multichoice
Priority:
Major
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
18 Apr 2012 at 06:36 UTC
Updated:
22 Jun 2014 at 16:17 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
Maks commentedHave the same problem.
Comment #2
jwjoshuawalker commentedSame here, I get that error and this one below it:
PDOException: SQLSTATE[22012]: Division by zero: 1365 Division by 0: UPDATE {quiz_node_results} SET score=ROUND( 100 * ( SELECT COALESCE (SUM(a.points_awarded), 0) FROM {quiz_node_results_answers} a WHERE a.result_id = {quiz_node_results}.result_id ) / ( SELECT max_score FROM {quiz_node_properties} qnp WHERE qnp.vid = {quiz_node_results}.vid ) ) WHERE (vid IN (:db_condition_placeholder_0, :db_condition_placeholder_1, :db_condition_placeholder_2)) ; Array ( [:db_condition_placeholder_0] => 4 [:db_condition_placeholder_1] => 8 [:db_condition_placeholder_2] => ) in quiz_update_max_score_properties() (line 2606 of .../sites/all/modules/quiz/quiz.module).
Comment #3
jwjoshuawalker commentedUpdate on this:
Reverting to the first revision of my Quiz let me delete some, but not all questions.
Deleting the quiz entirely allowed me to delete the questions.
Comment #4
burt.lo commentedThis bug is still present in 7.x-alpha9. I consistently get this when deleting a multiple choice question.
Comment #5
julianmancera commentedHi
I confirm the issue, it seems that the object rid is not part of the QuizQuestion class but part of the QuizQuestionResponse class. So it seems a reference problem. I think that the only condition that should match is the node id as here we are trying to delete the multichoice question, so it should delete all the results:
Line 313
And for the version condition it shouldn't match the rid as we are deleting all the quiz version answers.
Line 310
Julian Mancera
Comment #6
julianmancera commentedI also confirm the problem on #2 once the above is implemented, I think that during the delete process the script should look for the scores that sum 0 and remove them
Julian Mancera
Comment #7
chiko.mukwenha commentedThis problem is real against alpha9
@julianmancera, is that the patch you are suggesting?
Comment #8
paalj commentedI have created the patch described in #5.
#2 is covered here: http://drupal.org/node/1728390
Comment #9
paalj commentedComment #10
sivaji_ganesh_jojodae commentedIssue fixed. Including the division by zero exception. Thanks for reporting and sharing the patch.
Comment #11.0
(not verified) commentedjust a simple edit