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.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

juerg’s picture

The 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.

westwesterson’s picture

your right, this is a bug. Haven't had a lot of time to work on this lately, i will look into this.

craptaculus’s picture

Version: 6.x-2.x-dev » 5.x-2.0-beta3
FileSize
1.7 KB

Here'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.

westwesterson’s picture

Status: Active » Needs review

code 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.

westwesterson’s picture

Status: Needs review » Fixed

this was committed a while ago good patch :-)

Anonymous’s picture

Status: Fixed » Closed (fixed)

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