from otree.api import ( models, widgets, BaseConstants, BaseSubsession, BaseGroup, BasePlayer, Currency as c, currency_range, ) import random import csv import numpy doc = """ Part 2 - CQ: Instructions and Control Questions before Part 1: Rounds 1 to 20 (Players A ONLY) """ class Constants(BaseConstants): name_in_url = 'code_SS_part2_instr_and_CQ_playersA' players_per_group = 4 # --> only relevant for Players B - Part 2 # basically the group brings together all Players A from the same batch/session num_rounds = 1 class Subsession(BaseSubsession): cq2_n1_solution = models.IntegerField() cq2_n2_solution = models.IntegerField() cq2_n2_solution_to_show = models.StringField() n_tokens_equal_to_1_eur = models.IntegerField() def creating_session(self): self.cq2_n1_solution = self.session.config['cq2_n1_solution'] self.cq2_n2_solution = self.session.config['cq2_n2_solution'] self.cq2_n2_solution_to_show = self.session.config['cq2_n2_solution_to_show'] for p in self.get_players(): p.cq2_n1_solution = self.session.config['cq2_n1_solution'] # Correct answer = 20 Rounds p.cq2_n2_solution = self.session.config['cq2_n2_solution'] p.cq2_n2_solution_to_show = self.session.config['cq2_n2_solution_to_show'] # Correct answer = Paid for two randomly selected round out of the 20 played p.n_tokens_equal_to_1_eur = self.session.config['n_tokens_equal_to_1_eur'] # Conversion rate: number of tokens equal to 1 Euro class Group(BaseGroup): pass class Player(BasePlayer): cq2_n1 = models.IntegerField(label="", min=0, max=100) cq2_n2 = models.IntegerField(label="", choices=[[1, 'Tutti i round giocati (secondo il tasso conversione: 3 gettoni = 1 Euro)'], [2, 'Solo un round, selezionato casualmente (secondo il tasso conversione: 3 gettoni = 1 Euro)'], [3, 'Due round, selezionati casualmente (secondo il tasso conversione: 3 gettoni = 1 Euro)']], widget=widgets.RadioSelect, ) # cq2_n2_to_show = models.StringField() # cq2_n1_solution = models.IntegerField() cq2_n2_solution = models.IntegerField() cq2_n2_solution_to_show = models.StringField() # n_tokens_equal_to_1_eur = models.IntegerField() # re_read_instructions = models.IntegerField(initial=0)