Closed (fixed)
Project:
Quiz
Version:
5.x-2.0-beta3
Component:
Code
Priority:
Minor
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
27 Dec 2007 at 20:24 UTC
Updated:
19 Aug 2008 at 12:09 UTC
Jump to comment: Most recent file
After a question with several possible choices, only the last selected choice is displayed at the label "Your Answer(s):". So if the quiz taker has selected 3 options, it will only mention the last selected option.
However the test result is correctly evaluated.
You can see this behaviour after the second question at: http://timeforchange.org/global-warming-causes-test (Select several choices in question 2 and then see "Your Answer(s)" after you pressed the submit-button.
| Comment | File | Size | Author |
|---|---|---|---|
| #3 | multichoice-multianswer(needs review).patch | 1.7 KB | craptaculus |
Comments
Comment #1
juerg commentedThe table "Question Result(s)" at the end of the quiz does not correctly display the user choices either (again: this only happens if the user has multiple correct choices to select)
In addition, the test result is displayed as wrong even if the correct choices have been selected.
Comment #2
westwesterson commentedyour right, this is a bug. Haven't had a lot of time to work on this lately, i will look into this.
Comment #3
craptaculus commentedHere's a potential fix for this. I haven't evaluated it in context of everything else yet, just that it causes a multiple-answer question to be evaluated correctly.
Part of the problem was that multichoice_store_answer would only store one answer from a multiple-answer response because it merely checked for the existence of an answer rather than the count to determine whether to update or to insert.
The other part appears to be the check:
return ($correct_answers === $tried);
Changing it to:
return (array_values($correct_answers) === array_values($tried));
seemed to correct the problem, but I'm unsure if that's the proper course. No time to check it out right now.
Hope this helps.
Comment #4
westwesterson commentedcode seems to test out, and it looks good. Would be nice to have another set of eyes on the code. Submitting this to the dev version for testing.
Comment #5
westwesterson commentedthis was committed a while ago good patch :-)
Comment #6
Anonymous (not verified) commentedAutomatically closed -- issue fixed for two weeks with no activity.