Hi,

I'm looking to produce a quiz, most of the questions are multiple choice questions, except 2 of them are free text entry fields, where the user has to guess an answer to the nearest value, and they get a fraction of the maximum scored based on how close they get

eg:
'Correct' answer - 100
10 points -> guess between 90-110
5 points -> guess 50-150
1 point -> guess 10-190
etc

The problem is I need the evaluation to be done immediately, I need to allow the users to see their score straight away, so there won't be time for any user to actually manually score it. I've currently set the type to short quiz question with the evaluation method set to manual, I'm prepared to write my own code to do the evaluation manually, that's not a problem, but I don't know how I'd hook into your system to change the scores, I assume I'd start from hook_form_alter?

Cheers

CommentFileSizeAuthor
#3 Quiz Presave output.png112.94 KBaps-Andrew
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

aps-Andrew created an issue. See original summary.

djdevin’s picture

Hi,

5.x has more support for this as you can use hook_quiz_result_answer_presave($qra) to modify the score before it is recorded.

In 4.x I believe you are limited to the built-in regular expression support.

aps-Andrew’s picture

FileSize
112.94 KB

Hi,

I've just installed the dev version of 5.x so I've got access to that hook now, that's great thanks, but still, how do I actually view and edit the data? I've just called the hook and opened up the $qra item, and it's an array of variables, I can't see the raw data, I've attached the output from one of my questions, I assume the value I want to edit is $qra['points_awarded'] value once I know how many I want to award, but the data I entered was 'Test' and that isn't appearing, is there another function I can run to retrieve the raw answer?

djdevin’s picture

Version: 7.x-4.0-rc2 » 7.x-5.x-dev