from otree.api import Currency as c, currency_range from ._builtin import Page, WaitPage from .models import Constants class Intro(Page): form_model = 'player' class Equations(Page): form_model = 'player' form_fields = ['eq1', 'eq2', 'eq3', 'eq4', 'eq5', 'eq6', 'eq7', 'eq8', 'eq9', 'eq10'] timeout_seconds = 30 def before_next_page(self): #Generate random number self.player.posibility() if self.player.eq1 == 4: #Hvor mye poeng man får for å ha rett self.player.this_round_point = self.player.this_round_point + 3 if self.player.eq2 == 40: self.player.this_round_point = self.player.this_round_point + 3 if self.player.eq3 == 15: self.player.this_round_point = self.player.this_round_point + 3 if self.player.eq4 == 74: self.player.this_round_point = self.player.this_round_point + 3 if self.player.eq5 == 36: self.player.this_round_point = self.player.this_round_point + 3 if self.player.eq6 == 21: self.player.this_round_point = self.player.this_round_point + 3 if self.player.eq7 == 22: self.player.this_round_point = self.player.this_round_point + 3 if self.player.eq8 == 11: self.player.this_round_point = self.player.this_round_point + 3 if self.player.eq9 == 60: self.player.this_round_point = self.player.this_round_point + 3 if self.player.eq10 == 17: self.player.this_round_point = self.player.this_round_point + 3 ###self.participant.vars['player_point'] = self.participant.vars['player_point'] + self.player.this_round_point #self.player.points_earned = self.participant.vars['player_point'] class Deklarer_poeng(Page): form_model = 'player' form_fields = ['declare'] def before_next_page(self): #Regn ut skatt mengde_ikke_deklarert = self.player.this_round_point - self.player.declare self.player.score_after_taxes = self.player.this_round_point * 0.6 #størrelse fine self.player.fine = mengde_ikke_deklarert * 2 #Det man ikke deklarerer betaler man straff på #Score (Got audited) self.player.got_audited_score = (self.player.this_round_point * 0.6) - ((self.player.this_round_point - self.player.declare )*2) #Score (Did not get audited) self.player.not_audited_score = (self.player.declare * 0.6) + self.player.not_deklarert class Got_Audited(Page): form_model = 'player' def is_displayed(self): if self.player.random_num <= 5: if self.player.declare == self.player.this_round_point: self.player.payoff = (self.player.declare * 0.6) + (self.player.this_round_point -self.player.declare) self.player.got_audited_and_everything_declared = True return True self.player.payoff = (self.player.this_round_point * 0.6) - ((self.player.this_round_point - self.player.declare )*2) self.player.got_audited_and_everything_not_declared = True return True else: self.player.payoff = (self.player.declare * 0.6) + (self.player.this_round_point -self.player.declare) return False class Show_stats(Page): form_model = 'player' page_sequence = [Intro, Equations, Deklarer_poeng, Got_Audited, Show_stats]