from otree.api import * doc = """ Your app description """ class C(BaseConstants): NAME_IN_URL = 'noPay' PLAYERS_PER_GROUP = None NUM_ROUNDS = 1 class Subsession(BaseSubsession): pass class Group(BaseGroup): pass class Player(BasePlayer): feedback_final = models.LongStringField( label="", blank=True ) # PAGES class Feedback(Page): form_model = 'player' form_fields = ['feedback_final'] @staticmethod def is_displayed(player: Player): return not player.participant.pay_APP class ExitPage(Page): # For not consenting participants form_model = 'player' # Conditional JS variables based on participant status, same links but different reasons @staticmethod def js_vars(player: Player): if not player.participant.consented: player.participant.reason="You did not consent to the terms of the study. Please wait a few seconds while we redirect you to Prolific." player.participant.link_code = player.subsession.session.config['returnlink'] return dict( nopay= player.subsession.session.config['returnlink'] ) elif player.participant.global_forced_submits > player.participant.votes * 0.4: player.participant.reason="While you did complete the study, you were inactive too often (more than 40%) to be eligible for payment. Please wait a few seconds while we redirect you to Prolific." print(player.participant.reason) player.participant.link_code = player.subsession.session.config['returnlink'] return dict( nopay= player.subsession.session.config['returnlink'] ) elif player.participant.training_fail: player.participant.reason = "You failed to answer the same practice question three times. Please wait a few seconds while we redirect you to Prolific." player.participant.link_code = player.subsession.session.config['returnlink'] return dict( nopay= player.subsession.session.config['returnlink'] ) @staticmethod def is_displayed(player: Player): return not player.participant.pay_APP page_sequence = [Feedback, ExitPage]