from otree.api import ( models, widgets, BaseConstants, BaseSubsession, BaseGroup, BasePlayer, Currency as c, currency_range, ) author = 'Maren & Mounir' doc = """ This app is for the Cognitive Reflection Test (CRT) """ class Constants(BaseConstants): name_in_url = 'cog' players_per_group = None num_rounds = 1 class Subsession(BaseSubsession): pass class Group(BaseGroup): pass class Player(BasePlayer): #functions to calculate CRT-score and if CRT-questions are correct def set_is_crt_bat_correct(self): self.crt_bat_correct = self.crt_bat == 100 def set_is_crt_widget_correct(self): self.crt_widget_correct = self.crt_widget == 5 def set_is_crt_lake_correct(self): self.crt_lake_correct = self.crt_lake == 47 def set_crt_score(self): self.crt_score = getattr(self, 'crt_bat_correct') + getattr(self, 'crt_widget_correct') + getattr(self, 'crt_lake_correct') #boolean variables to check for CRT-questions crt_bat_correct= models.BooleanField(initial = None) crt_widget_correct = models.BooleanField(initial = None) crt_lake_correct = models.BooleanField(initial = None) crt_score = models.PositiveIntegerField() #formfields for input crt_bat = models.PositiveIntegerField() crt_widget = models.PositiveIntegerField() crt_lake = models.PositiveIntegerField()