from otree.api import ( models, widgets, BaseConstants, BaseSubsession, BaseGroup, BasePlayer, Currency as c, currency_range ) doc = '' class Constants(BaseConstants): name_in_url = 'Survey' players_per_group = None num_rounds = 1 endowment = c(100) class Subsession(BaseSubsession): pass class Group(BaseGroup): pass class Player(BasePlayer): R1 = models.IntegerField(label='If the computer invests 20, what is your investment?', max=100, min=0) R2 = models.IntegerField(label='If the computer invests 60, what is your investment?', max=100, min=0) R3 = models.IntegerField(label='If the computer invests 0, what is your investment?', max=100, min=0) R4 = models.IntegerField(label='If the computer invests 80, what is your investment?', max=100, min=0) R5 = models.IntegerField(label='If the computer invests 40, what is your investment?', max=100, min=0) total_investment = models.IntegerField(max=500, min=0) def totalrisk(self): self.total_investment = self.R1 + self.R2 + self.R3 + self.R4 + self.R5 self.participant.vars["risk"] = self.total_investment