from otree.api import * c = cu doc = 'Afast' class Constants(BaseConstants): name_in_url = 'senderfast' players_per_group = None num_rounds = 1 endowment = cu(100) consentform_template = 'senderfast/consentform.html' instructions_template = 'senderfast/instructions.html' resultsoffer_template = 'senderfast/resultsoffer.html' class Subsession(BaseSubsession): pass class Group(BaseGroup): pass class Player(BasePlayer): age = models.IntegerField(label='What is your age?') sex = models.StringField(choices=[['Male', 'Male'], ['Female', 'Female']], label='What is your sex?', widget=widgets.RadioSelect) gender = models.StringField(blank=True, choices=[['Yes', 'Yes'], ['No', 'No']], label='Is the gender you identify with the same as your sex registered at birth? (This question is Voluntary)', widget=widgets.RadioSelect) gidentity = models.StringField(blank=True, label='If not, enter gender identity (Voluntary)') studies = models.StringField(choices=[['Some High School Education', 'Some High School Education'], ['High School Diploma', 'High School Diploma'], ['Vocational Training', 'Vocational Training'], ['Undergraduate Degree', 'Undergraduate Degree'], ['Postgraduate Degree', 'Postgraduate Degree'], ['Other', 'Other']], label='Select your highest level of studies finished', widget=widgets.RadioSelect) experience = models.StringField(choices=[['Yes', 'Yes'], ['No', 'No'], ["I don't know", "I don't know"]], label='Have you participated in similar academic experiments before?', widget=widgets.RadioSelect) p1 = models.StringField(choices=[['Never', 'Never'], ['Sometimes', 'Sometimes'], ['About half of the time', 'About half of the time'], ['Most of the time', 'Most of the time'], ['Always', 'Always']], label='1. I trust my intuition', widget=widgets.RadioSelectHorizontal) p2 = models.StringField(choices=[['Never', 'Never'], ['Sometimes', 'Sometimes'], ['About half of the time', 'About half of the time'], ['Most of the time', 'Most of the time'], ['Always', 'Always']], label='2. I make rash decisions', widget=widgets.RadioSelectHorizontal) p3 = models.StringField(choices=[['Never', 'Never'], ['Sometimes', 'Sometimes'], ['About half of the time', 'About half of the time'], ['Most of the time', 'Most of the time'], ['Always', 'Always']], label='3. I jump into things without thinking', widget=widgets.RadioSelectHorizontal) p4 = models.StringField(choices=[['Never', 'Never'], ['Sometimes', 'Sometimes'], ['About half of the time', 'About half of the time'], ['Most of the time', 'Most of the time'], ['Always', 'Always']], label='4. When I make decisions, I prefer to think carefully about them', widget=widgets.RadioSelectHorizontal) nationality = models.StringField(label='Nationality (please write below)') sother = models.StringField(blank=True, label='If other, please describe') reason = models.LongStringField(label='Briefly describe why you chose to send such amount.') willing = models.FloatField(label='If you played again the game and you were assigned Role B, what is the lowest amount you would be willing to accept from the other participant? (Your choice must be between 0 and 100 cents)', max=100, min=0) offer = models.IntegerField(label='I will offer (in cents)', max=100, min=0) MTurkID = models.StringField(label="Please, write down your MTurk ID here.") failed_to_submit = models.BooleanField(initial=False) class Consent(Page): form_model = 'player' class ID(Page): form_model = 'player' form_fields = ['MTurkID'] class Introduction(Page): form_model = 'player' class GameA(Page): form_model = 'player' form_fields = ['offer'] timeout_seconds = 10 def before_next_page(player, timeout_happened): participant=player.participant if timeout_happened: player.failed_to_submit = True class failed_to_submit(Page): def is_displayed(player): return player.failed_to_submit class ResultsA(Page): def is_displayed(player): return not player.failed_to_submit class Survey(Page): form_model = 'player' form_fields = ['p1', 'p2', 'p3', 'p4', 'age', 'sex', 'gender', 'gidentity', 'nationality', 'studies', 'sother', 'experience', 'reason', 'willing'] class End(Page): form_model = 'player' page_sequence = [Consent, ID, Introduction, GameA, failed_to_submit, ResultsA, Survey, End]