from otree.api import * doc = """ Your app description """ class C(BaseConstants): NAME_IN_URL = 'o1' PLAYERS_PER_GROUP = None NUM_ROUNDS = 1 class Subsession(BaseSubsession): def allocation_rate(self): return self.session.config['allocation_rate'] def allocation_decision(self): return self.session.config['allocation_decision'] def allocation_today(self): return self.session.config['allocation_today'] def allocation_1week(self): return self.session.config['allocation_1week'] def allocation_2week(self): return self.session.config['allocation_2week'] def allocation_3week(self): return self.session.config['allocation_3week'] def today_m(self): return self.session.config['today_m'] def today_d(self): return self.session.config['today_d'] def week1_m(self): return self.session.config['week1_m'] def week1_d(self): return self.session.config['week1_d'] class Group(BaseGroup): pass class Player(BasePlayer): effort = models.IntegerField(initial = 0) effort_time = models.StringField(initial = '0') effort_correct = models.StringField(initial = '0') effort_grade = models.StringField(initial = '0') def creating_session(subsession): for player in subsession.get_players(): player.participant.vars['allocation_rate'] = subsession.allocation_rate() player.participant.vars['allocation_decision'] = subsession.allocation_decision() player.participant.vars['allocation_today'] = subsession.allocation_today() player.participant.vars['allocation_1week'] = subsession.allocation_1week() player.participant.vars['today_m'] = subsession.today_m() player.participant.vars['today_d'] = subsession.today_d() player.participant.vars['week1_m'] = subsession.week1_m() player.participant.vars['week1_d'] = subsession.week1_d() # PAGES class Number(Page): @staticmethod def vars_for_template(player): return dict( decision = player.participant.allocation_decision, rate = player.participant.allocation_rate, allocation_today = player.participant.allocation_today, allocation_1week = player.participant.allocation_1week, today_m = player.participant.today_m, today_d = player.participant.today_d, week1_m = player.participant.week1_m, week1_d = player.participant.week1_d, ) class Effort(Page): form_model = 'player' @staticmethod def live_method(player, data): player.effort = data['effort'] player.effort_time = data['effort_time'] player.effort_correct = data['effort_correct'] player.effort_grade = data['effort_grade'] @staticmethod def vars_for_template(player): return dict( target=player.participant.allocation_1week, ) class Results(Page): pass page_sequence = [Number, Effort, Results]