Early Bird Registration for DrupalCon Portland 2024 is open! Register by 23:59 PST on 31 March 2024, to get $100 off your ticket.
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 CreditAttribution: 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 CreditAttribution: 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 CreditAttribution: 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 CreditAttribution: 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 CreditAttribution: westwesterson commentedthis was committed a while ago good patch :-)
Comment #6
Anonymous (not verified) CreditAttribution: Anonymous commentedAutomatically closed -- issue fixed for two weeks with no activity.