from otree.api import * import random doc = """ Your app description """ class C(BaseConstants): NAME_IN_URL = 'time_example' PLAYERS_PER_GROUP = None NUM_ROUNDS = 1 class Subsession(BaseSubsession): pass class Group(BaseGroup): pass class Player(BasePlayer): waiting_time_expiration_time = models.FloatField(initial=0) waiting_time_expired = models.BooleanField(initial=False) timeout_elapsed = models.BooleanField(initial=False) order_tmp = models.StringField() math1 = models.FloatField( min=0, max=10 ) soc1 = models.FloatField( min=0, max=10 ) comb1 = models.FloatField( min=0, max=10 ) math2 = models.FloatField( min=0, max=10 ) soc2 = models.FloatField( min=0, max=10 ) comb2 = models.FloatField( min=0, max=10 ) math3 = models.FloatField( min=0, max=10 ) soc3 = models.FloatField( min=0, max=10 ) comb3 = models.FloatField( min=0, max=10 ) math4 = models.FloatField( min=0, max=10 ) soc4 = models.FloatField( min=0, max=10 ) comb4 = models.FloatField( min=0, max=10 ) math5 = models.FloatField( min=0, max=10 ) soc5 = models.FloatField( min=0, max=10 ) comb5 = models.FloatField( min=0, max=10 ) math6 = models.FloatField( min=0, max=10 ) soc6 = models.FloatField( min=0, max=10 ) comb6 = models.FloatField( min=0, max=10 ) math7 = models.FloatField( min=0, max=10 ) soc7 = models.FloatField( min=0, max=10 ) comb7 = models.FloatField( min=0, max=10 ) math8 = models.FloatField( min=0, max=10 ) soc8 = models.FloatField( min=0, max=10 ) comb8 = models.FloatField( min=0, max=10 ) math9 = models.FloatField( min=0, max=10 ) soc9 = models.FloatField( min=0, max=10 ) comb9 = models.FloatField( min=0, max=10 ) math10 = models.FloatField( min=0, max=10 ) soc10 = models.FloatField( min=0, max=10 ) comb10 = models.FloatField( min=0, max=10 ) math11 = models.FloatField( min=0, max=10 ) soc11 = models.FloatField( min=0, max=10 ) comb11 = models.FloatField( min=0, max=10 ) math12 = models.FloatField( min=0, max=10 ) soc12 = models.FloatField( min=0, max=10 ) comb12 = models.FloatField( min=0, max=10 ) # PAGES # class MyPage1(Page): # @staticmethod # def before_next_page(player, timeout_happened): # participant = player.participant # import time # # # remember to add 'expiry' to PARTICIPANT_FIELDS. # participant.expiry = time.time() + 1 * 300 # def get_timeout_seconds(player): # participant = player.participant # import time # return participant.expiry - time.time() class MyPage4(Page): form_model = 'player' form_fields = ['soc1', 'math1', 'comb1', 'soc2', 'math2', 'comb2', 'soc3', 'math3', 'comb3'] @staticmethod def vars_for_template(player): x = int(random.uniform(1, 3)) player.order_tmp='bos2eval.png' if x == 1: img1 = player.order_tmp name1 = 'Koala Panda' elif x == 2: img1 = 'pd2eval.png' name1 = 'Panda Koala' return dict( img1=img1, name1=name1 ) class MyPage1(Page): pass class ResultsWaitPage(WaitPage): pass class Results(Page): pass page_sequence = [MyPage4]