from otree.api import * c = Currency doc = """ Your app description """ class C(BaseConstants): NAME_IN_URL = 'results' PLAYERS_PER_GROUP = None NUM_ROUNDS = 1 CUSTOM_POINTS_NAME = 'E' class Subsession(BaseSubsession): pass class Group(BaseGroup): pass class Player(BasePlayer): pass # FUNCTIONS def set_participant_payoff(participant: Player.participant, exchange_rate: float): payoff = participant.lottery_payoff + \ participant.svo_payoff + \ participant.ee_ne_cc_payoff + participant.tax_game_payoff print(participant.lottery_payoff, participant.svo_payoff, participant.ee_ne_cc_payoff, participant.tax_game_payoff) print(payoff) print(exchange_rate) participant.payoff = payoff participant.payoff_real = round(payoff * exchange_rate, 2) # PAGES class TimeOut(Page): @staticmethod def is_displayed(player: Player): return player.participant.dropout class Excluded(Page): @staticmethod def is_displayed(player: Player): return player.participant.excluded @staticmethod def vars_for_template(player: Player): exchange_rate = player.session.config['real_world_currency_per_point'] participant = player.participant set_participant_payoff(participant, exchange_rate) return dict() class Results(Page): @staticmethod def vars_for_template(player: Player): exchange_rate = player.session.config['real_world_currency_per_point'] participant = player.participant set_participant_payoff(participant, exchange_rate) return dict( lottery_payoff_real=round(participant.lottery_payoff * exchange_rate, 2), svo_payoff_real=round(participant.svo_payoff * exchange_rate, 2), ee_ne_cc_payoff_real=round(participant.ee_ne_cc_payoff * exchange_rate, 2), tax_game_payoff_real=round(participant.tax_game_payoff * exchange_rate, 2) ) page_sequence = [TimeOut, Excluded, Results]