from otree.api import ( models, widgets, BaseConstants, BaseSubsession, BaseGroup, BasePlayer, Currency as c, currency_range, ) import random author = 'Damien Jourdain' doc = """ Consent Form and MCF Scholar identification """ class Constants(BaseConstants): name_in_url = 'Introduction' players_per_group = None num_rounds = 1 class Subsession(BaseSubsession): def creating_session(self): # labels = ['MCF_1', 'MCF_2', 'MCF_3', 'MCF_4', 'MCF_6', 'NMCF_1', 'NMCF_2', 'MCF_6', # 'NMCF_3', 'NMCF_4', 'NMCF_5', 'NMCF_6'] which_game = random.randint(0, 2) # selection of the game that will be paid for p in self.get_players(): p.participant.vars['which_game'] = which_game # mcfs = [True, True, True, True, True, False, False, True, False, False, False, False ] # with_mcf = [True, True, True, True, False,True, True, False, False, False, False, False] # # for p, label in zip(self.get_players(), labels): # p.participant.label = label # # for p, mcf in zip(self.get_players(), mcfs): # p.is_mcf = mcf # p.participant.vars['is_mcf'] = mcf # # for p, withmcf in zip(self.get_players(), with_mcf): # p.with_mcf = withmcf # p.participant.vars['with_mcf'] = withmcf class Group(BaseGroup): pass class Player(BasePlayer): pass # consent_accepted = models.BooleanField() # is_mcf = models.BooleanField( # label = "Did you receive a MCF Scholarship? ") # with_mcf = models.BooleanField() # bot_check = models.IntegerField(min=0, max=10, initial = 2) # # cellno = models.StringField() # # provider = models.IntegerField( # label = 'Which South African network provider do you use?', # widget=widgets.RadioSelectHorizontal, # choices=[ # [0, 'Telkom'], # [1, 'Vodacom'], # [2, 'MTN'] # ] ) # def set_consent(self): self.participant.vars['consent_accepted']=self.consent_accepted