oTree Forum >

Quiz allowing repeated attempt but counting them

#1 by AndreL

Hi again,

How can I implement a multi-question quiz that (as usual) allows subjects to re-take questions as many times as needed until they get everything correct, but also counts how many attempts they make at each question?

To clarify: the quiz will be on just one page/app, containing several questions, and subjects click "Submit" when ready. The idea is to deduct penalties the more times they attempt before getting it right.

Regards
Andre

#2 by Chris_oTree

Hi, it sounds like you're trying to record the number of wrong answers for each questions separately? (i.e. q1 wrong 2 times, q2 wrong 0 times, q3 wrong 4 times, etc...)

See here:

https://www.otreehub.com/forum/116/

In your case, you can count how many times the questions were answered wrong with this code, which you can put in before_next_page or some set_payoffs function:

# count of all incorrect responses
len(IncorrectResponse.filter(player=player))

# count of incorrect responses to a particular question
len(IncorrectResponse.filter(player=player, field_name='xyz'))

By the way thank you for the donation :)

Write a reply

Set forum username