from otree.api import * c = cu from otree.api import ( models, widgets, BaseConstants, BaseSubsession, BaseGroup, BasePlayer, Currency as c, currency_range, ) from otree.models import subsession author = "Your name here" doc = """ Your app description """ # TODO set up participant labels for Prolific https://otree.readthedocs.io/en/latest/admin.html#participant-label ; https://researcher-help.prolific.co/hc/en-gb/articles/360009220993-Recording-participants-Prolific-IDs-in-your-study-survey # TODO set up redirection to completion page https://researcher-help.prolific.co/hc/en-gb/articles/360009223173 # TODO speak about payment mechanisms https://researcher-help.prolific.co/hc/en-gb/articles/360009220393-How-participants-are-paid from static_data.rnd_numbers import rnd_numbers from static_data.choices_data import data, gamble class Constants(BaseConstants): name_in_url = "intro" players_per_group = None num_rounds = 1 rnd_numbers = rnd_numbers envelopes = data class Subsession(BaseSubsession): def creating_session(self): """define balanced treatments as described by official documentation """ self.session.vars["completions_by_treatment"] = {"True": 0, "False": 0} import itertools treats = itertools.cycle([True, False]) for player in self.get_players(): player.treatment_descending = next(treats) class Group(BaseGroup): pass class Player(BasePlayer): treatment_descending = models.BooleanField() prolID = models.StringField(label="Prolific ID:") consent_privacy = models.BooleanField( label="I have read the participation rules and privacy policy and consent with it:", choices=[[True, "Yes"], [False, "No"]], ) download_bool = models.BooleanField( initial=False, label=" I have downloaded the password protected PDF containing the choice that is real for me.", ) user_chosen_decision = models.StringField() def live_decision(self, data): self.user_chosen_decision = data print(f"you chose decision {data}") return {self.id_in_group: data} attention_check_1 = models.StringField() attention_check_1_b = models.StringField() attention_check_1_c = models.StringField() attention_check_1_d = models.StringField() attention_check_1_e = models.StringField() attention_check_1_f = models.StringField() attention_check_1_g = models.StringField() attention_check_2 = models.StringField() attention_check_2_a = models.StringField() attention_check_2_b = models.StringField() attention_check_2_2_a = models.StringField() attention_check_3 = models.StringField() attention_check_4 = models.StringField() example_question_check = models.BooleanField() verification_download_bool = models.BooleanField(initial=False)