from otree.api import ( models, widgets, BaseConstants, BaseSubsession, BaseGroup, BasePlayer, Currency as c, currency_range, ) import random import itertools import numpy as np from django import forms from django.forms import widgets as django_widgets import math author = 'Jindi Huang' doc = """ WTA-WTP Gap """ class Constants(BaseConstants): name_in_url = 'instructions_stage1' players_per_group = None num_rounds = 1 attention1_options = [ ['1', "Extremely interested"], ['2', "Very interested"], ['3', "A little bit interested"], ['4', "Very little interested"], ['5', "Not at all interested"] ] class Subsession(BaseSubsession): def creating_session(self): if self.round_number == 1: for p in self.get_players(): p.participant.vars['attention_got_wrong'] = False p.participant.vars['wait_page_arrival'] = 0 class Group(BaseGroup): pass class Player(BasePlayer): prolific_id = models.StringField(label="") # attention1_check = models.StringField( # widget=forms.widgets.CheckboxSelectMultiple(choices=Constants.attention1_options), # blank=False, # label="" # ) attention2_check = models.StringField( blank=True, label="" ) attention_got_wrong = models.BooleanField(initial=False) def prolific_id_error_message(self, value): if len(value) != 24: return "The prolific ID should have 24 alphanumeric characters."