from otree.api import ( models, widgets, BaseConstants, BaseSubsession, BaseGroup, BasePlayer, Currency as c, currency_range, ) import random from datetime import date from django import forms class Constants(BaseConstants): name_in_url = 'UK_survey_2022' players_per_group = None num_rounds = 1 class Subsession(BaseSubsession): # def creating_session(self): # randomize wedge # for player in self.get_players(): # player.q1_fare_1 = 10 # player.payout_matchnum = random.choice(list(range(1, 5))) # player.wedge = random.choice([-2.5, -1.5, -0.5, 0, 0.5, 1.5, 2.5]) # player.wedge1 = random.choice([-2.5, -1.5, -0.5, 0, 0.5, 1.5, 2.5]) # player.wedge2 = random.choice([-2.5, -1.5, -0.5, 0, 0.5, 1.5, 2.5]) # player.wedge3 = random.choice([-2.5, -1.5, -0.5, 0, 0.5, 1.5, 2.5]) # player.wedge4 = random.choice([-2.5, -1.5, -0.5, 0, 0.5, 1.5, 2.5]) # player.wedge5 = random.choice([-2.5, -1.5, -0.5, 0, 0.5, 1.5, 2.5]) # player.treat = random.choice(["Control", "Subj. Beliefs", "Bookmaker Beliefs"]) pass class Group(BaseGroup): pass club_list = ["None", "AFC Bournemouth", "Aston Villa", "Brentford", "Brighton & Hove Albion", "Crystal Palace", "FC Arsenal", "FC Chelsea", "FC Everton", "FC Fulham", "FC Liverpool", "FC Southampton", "Leeds United", "Leicester City", "Manchester City", "Manchester United", "Newcastle United", "Nottingham Forest", "Tottenham Hotspurs", "West Ham United", "Wolverhampton Wanderers"] class Player(BasePlayer): agree_survey = models.IntegerField(choices=[[1, 'I consent to participating'], [0, 'I do not consent to participating']], label='Do you consent to participating in this survey?', widget=widgets.RadioSelect) fav_club = models.StringField(choices=club_list, widget=widgets.RadioSelect, label="") fav_club_supp = models.IntegerField(label="", min=0, max=100) fav_club_2nd = models.StringField(choices=club_list, widget=widgets.RadioSelect, label="") fav_club_2nd_supp = models.IntegerField(label="", min=0, max=100) least_fav_club = models.StringField(choices=club_list, widget=widgets.RadioSelect, label="") least_fav_club_dislike = models.IntegerField(label="", min=0, max=100) least_fav_club_2nd = models.StringField(choices=club_list, widget=widgets.RadioSelect, label="") least_fav_club_2nd_dislike = models.IntegerField(label="", min=0, max=100) chelsea_rank = models.FloatField() arsenal_rank = models.FloatField() liverpool_rank = models.FloatField() manu_rank = models.FloatField() mancity_rank = models.FloatField() spurs_rank = models.FloatField() newcastle_rank = models.FloatField() chelsea_certain= models.FloatField() arsenal_certain = models.FloatField() liverpool_certain = models.FloatField() manu_certain = models.FloatField() mancity_certain = models.FloatField() spurs_certain = models.FloatField() newcastle_certain = models.FloatField() Introduction_time = models.FloatField() fav_club_time = models.FloatField() fav_club_supp_time = models.FloatField() fav_club_2nd_time = models.FloatField() fav_club_2nd_supp_time = models.FloatField() least_fav_club_time = models.FloatField() least_fav_club_dislike_time = models.FloatField() least_fav_club_2nd_time = models.FloatField() least_fav_club_2nd_dislike_time = models.FloatField() Introduction_ranking_time = models.FloatField() chelsea_rank_time = models.FloatField() arsenal_rank_time = models.FloatField() liverpool_rank_time = models.FloatField() manu_rank_time = models.FloatField() mancity_rank_time = models.FloatField() spurs_rank_time = models.FloatField() newcastle_rank_time = models.FloatField() ThankYou_time = models.FloatField()