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 = 'my_first_crt' players_per_group = None num_rounds = 1 correct_answers = [1,5,47] class Subsession(BaseSubsession): pass class Group(BaseGroup): pass class Player(BasePlayer): age = models.PositiveIntegerField(choices=range(15,99+1,1), verbose_name="How old are you?") gender = models.CharField(choices=['Male', 'Female'], verbose_name="What is your gender?") student = models.BooleanField(choices=[[0,'No way!'],[1,'Sure']], verbose_name="Are you a student?") crt_bat = models.PositiveIntegerField(verbose_name=''' A bat and a ball cost 22 euros in total. The bat costs 20 euros more than the ball. How much does the ball cost?''') crt_widget = models.PositiveIntegerField(verbose_name=''' If it takes 5 machines 5 minutes to make 5 widgets, how many minutes would it take 100 machines to make 100 widgets?''') crt_lake = models.PositiveIntegerField(verbose_name=''' In a lake, there is a patch of lily pads. Every day, the patch doubles in size. If it takes 48 days for the patch to cover the entire lake, how many days does it take for the patch to cover half of the lake?''') check_1 = models.BooleanField() check_2 = models.BooleanField() check_3 = models.BooleanField() def check_correct(self): self.check_1 = self.crt_bat == Constants.correct_answers[0] self.check_2 = self.crt_widget == Constants.correct_answers[1] self.check_3 = self.crt_lake == Constants.correct_answers[2]