oTree Forum >

Limit number of attempts on questions

#1 by simoncolumbus

Hi all,

I am sure this has been asked before, but my Google-fu is failing me. 

I have a number of comprehension check questions, implemented using the usual error_message method. I would like to limit the number of attempts on the entire set of questions. Participants who have not successfully answered all questions after the nth attempt should receive a message asking them to return the task on Prolific. Is there a standard / parsimonious way to do this?

#2 by gr0ssmann

Within the player object,

    attempts = models.IntegerField(initial=0)

Then, within your error_message method:

    if any_answer_wrong:
        player.attempts = player.attempts + 1

Note that an error message must also be returned if the allowable number of attempts has been exceeded.

On your page:

    {% if player.attempts > 10 %}
        <p>Sorry, you failed, badly.</p>
    {% else %}
        (Your questionnaire here)
    {% endif %}

#3 by Fanist

Hi, I think adding a trial variable in Player class is a potential way. Each time the participant reached an error, let player.trial +1 in error message function. Then add an "Exit" page after the question page in the page sequence. The Exist page has an "is_displayed" function that detects whether the participant has reached the max allowed error mistakes.

#4 by simoncolumbus

Thanks Max, helpful as always!

Write a reply

Set forum username