from otree.api import * doc = """ Your app description """ class C(BaseConstants): NAME_IN_URL = 'Pay' PLAYERS_PER_GROUP = None NUM_ROUNDS = 1 class Subsession(BaseSubsession): pass class Group(BaseGroup): pass class Player(BasePlayer): # Experiment-specific questions — only shown to committed, non-single participants feedback_1 = models.LongStringField(blank=True, label="Was one robot best throughout the experiment?") feedback_2 = models.LongStringField(blank=True, label="What do you think of the mission commander?") feedback_3 = models.LongStringField(blank=True, label="Overall, did your research team vote for better robots than the mission commander?") group_cohesion = models.IntegerField(blank=True, label="On a scale of 1-7, how much do you feel your Research Team worked together during the experiment?") ios_coordinates = models.LongStringField(blank=True) # Optional training comment — only shown to participants who completed training # but did not commit to the group phase (per conversation: conditionally shown # for not player.participant.committed) training_feedback = models.LongStringField(blank=True, label="If you would like to, please leave any comments about your experience doing the training. This can help us improve the experience of future participants.") # PAGES class Feedback(Page): form_model = 'player' form_fields = ['feedback_1', 'feedback_2', 'feedback_3', 'group_cohesion', 'ios_coordinates', 'training_feedback'] @staticmethod def is_displayed(player: Player): return player.participant.pay_APP class ExitPage(Page): form_model = 'player' # JS vars to determine which link and reason to display based on if they finished the entire app (participant.single_group == False) or waited too long @staticmethod def js_vars(player: Player): if not player.participant.committed: player.participant.reason = "You did not commit to entering the next phase of the study. You will be paid for completing the training. Please wait a few seconds while we redirect you to Prolific." player.participant.link_code = player.subsession.session.config['completionlink'] return dict( pay=player.subsession.session.config['completionlink'] ) # We use the bonus link to pay people extra for the waiting that they did elif player.participant.is_single: player.participant.reason = "You waited the full time but we could not find a group for you. You will be paid for completing the training and for the time you spent waiting. Please wait a few seconds as we redirect you to Prolific." player.participant.link_code = player.subsession.session.config['bonuslink'] return dict( pay=player.subsession.session.config['bonuslink'] ) else: # If you completed the committed, completed the experiment, and were not too inactive, you get paid:) player.participant.reason = "You completed the training, waited to be grouped, and completed the experiment! You will be paid for all three parts!" player.participant.link_code = player.subsession.session.config['bonuslink'] return dict( pay=player.subsession.session.config['bonuslink'] ) @staticmethod def is_displayed(player: Player): return player.participant.pay_APP page_sequence = [Feedback, ExitPage]