from otree.api import ( models, widgets, BaseConstants, BaseSubsession, BaseGroup, BasePlayer, Currency as c, currency_range ) import random author = 'Razvan' doc = """ Attention check """ class Constants(BaseConstants): name_in_url = 'Instructions' players_per_group = None num_rounds = 1 template_instructions='attention/instructions_template.html' class Subsession(BaseSubsession): def creating_session(self): if self.round_number == 1: for p in self.get_players(): if 'treatment_confrontation' in self.session.config: p.participant.vars['treatment_confrontation'] = self.session.config['treatment_confrontation'] else: p.participant.vars['treatment_confrontation'] = random.choice([0, 1]) if 'treatment_info' in self.session.config: p.participant.vars['treatment_info'] = self.session.config['treatment_info'] else: p.participant.vars['treatment_info'] = random.choice([0, 1, 2]) #0=outcome only #1=outcome+effort #2=effort only class Group(BaseGroup): pass class Player(BasePlayer): payment_task = models.PositiveIntegerField() understanding_questions_wrong_attempts = models.PositiveIntegerField() ip=models.StringField()