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 = 'results' players_per_group = None num_rounds = 1 class Subsession(BaseSubsession): pass class Group(BaseGroup): pass class Player(BasePlayer): TASK_status = models.StringField() kart_numarasi = models.IntegerField() gender = models.StringField() constant_payoff = models.CurrencyField() status = models.CurrencyField() rakip_status = models.FloatField() genn = models.FloatField() rakip_genn_2 = models.FloatField() rakip_genn_3 = models.FloatField() total_payoff = models.CurrencyField() PGG2_payoff = models.CurrencyField() PGG3_payoff = models.CurrencyField() TL = models.CurrencyField() TL_son = models.FloatField() contribution_son2 = models.CurrencyField() rakip_contribution2 = models.CurrencyField() total_contribution2 = models.CurrencyField() contribution_son_3 = models.CurrencyField() rakip_contribution_3 = models.CurrencyField() total_contribution_3 = models.CurrencyField() def son_payoff(self): for p in self.group.get_players(): p.total_contribution2 = p.participant.vars['PGG2_chosen_contribution'] + p.participant.vars['PGG2_rakip_contribution'] p.total_contribution_3 = p.participant.vars['PGG3_chosen_contribution'] + p.participant.vars['PGG3_rakip_contribution'] p.total_payoff = p.PGG2_payoff + p.PGG3_payoff + p.constant_payoff p.TL = p.total_payoff * 0.2 p.TL_son = float(p.TL)