from otree.api import ( models, widgets, BaseConstants, BaseSubsession, BaseGroup, BasePlayer, Currency as c, currency_range, ) author = 'Your name here' doc = """ Your app description """ class Constants(BaseConstants): name_in_url = 'Instruction_Songs' players_per_group = None num_rounds = 1 name1 = "George Steiner" name2 = "Frank Kermode" name3 = "John Sutherland" class Subsession(BaseSubsession): pass class Group(BaseGroup): pass class Player(BasePlayer): seconds = models.IntegerField() answer1 = models.IntegerField(label="", choices=[[1, Constants.name1], [2, Constants.name2], [3, Constants.name3], ]) answer2 = models.IntegerField(label="", choices=[[1, Constants.name1], [2, Constants.name2], [3, Constants.name3], ]) answer3 = models.IntegerField(label="", choices=[[1, Constants.name1], [2, Constants.name2], [3, Constants.name3], ]) answer4 = models.IntegerField(label="", choices=[[1, Constants.name1], [2, Constants.name2], [3, Constants.name3], ]) answer5 = models.IntegerField(label="", choices=[[1, Constants.name1], [2, Constants.name2], [3, Constants.name3], ]) time_in = models.FloatField() time_out = models.FloatField() time_spent = models.FloatField() def set_time_spent(self): self.time_spent = self.time_out - self.time_in