from otree.api import Currency as c, currency_range from ._builtin import Page, WaitPage from .models import Constants class MyPage(Page): # variables for template # ---------------------------------------------------------------------------------------------------------------- def vars_for_template(self): return { 'scl_payoff': self.participant.vars['scl_payoff'], 'lottery_choice': self.participant.vars['lottery_choice'], 'outcome_lo': self.participant.vars['outcome_lo'], 'outcome_hi': self.participant.vars['outcome_hi'], 'hi_lo': "B" if self.player.participant.vars['outcome_to_pay'] == "high" else "A", 'rows_right': self.participant.vars['rows_right'], 'rows_payoff': self.participant.vars['rows_payoff'], 'contribution_within': self.participant.vars['contribution_within'], 'contribution_between': self.participant.vars['contribution_between'], 'keep': self.participant.vars['keep'], 'subgroup1_within': self.group.subgroup1_within, 'subgroup2_within': self.group.subgroup2_within, 'subgroup1_between': self.group.subgroup1_between, 'subgroup2_between': self.group.subgroup2_between, 'IPD_payoff': self.player.payoff + self.player.payoff_extra, 'id_in_group': self.player.id_in_group, 'role': self.player.role(), 'payoff_extra': self.player.payoff_extra, 'exp_right': self.player.exp_right, 'final_payoff_with_endowment': Constants.show_up + self.player.payoff_extra + self.player.payoff + self.participant.vars['scl_payoff'] + self.participant.vars['rows_payoff'], 'subtract_b': self.player.subtract_b, 'payback_a': self.player.payback_a, 'payback_b': self.player.payback_b, } class BeforeEnd( Page ): form_model = 'player' form_fields = ['water', 'known_others', 'known_from'] class MyWaitPage( WaitPage ): template_name = 'meta_results_old/MyWaitPage.html' title_text = "Bitte warten Sie, bis die anderen Teilnehmer bereit sind." body_text = "Sie können in der Zeit ein Spiel spielen. Nutzen Sie dazu die Pfeiltasten auf der Tastatur, um den roten Punkt ein zu fangen." def after_all_players_arrive(self): self.group.set_payoffs() class Results(Page): def vars_for_template(self): return { 'final_payoff_with_endowment': Constants.show_up + self.player.payoff + self.player.payoff_extra + self.participant.vars['scl_payoff'] + self.participant.vars['rows_payoff'] , 'id_in_group': self.player.id_in_group } page_sequence = [ BeforeEnd, MyWaitPage, MyPage, Results ]