from otree.api import * from oneapp import Constants as OneappConstants from helpers import calculate_and_store_profit doc = """ This app is the final part of the experiment and includes a page, that informs the participants about their payment. """ class Constants(BaseConstants): name_in_url = "end" players_per_group = None num_rounds = 1 class Subsession(BaseSubsession): pass class Group(BaseGroup): pass class Player(BasePlayer): pass class GoToSummary(Page): timeout_seconds = 600 @staticmethod def before_next_page(player: Player, timeout_happened): calculate_and_store_profit(player) class Summary(Page): @staticmethod def vars_for_template(player: Player): participant = player.participant subtraction_rep = "false" if participant.subtraction_pay == 0 else "correct" session = player.session pfee = session.config["participation_fee"] total = pfee + participant.payoff_performance return dict( crt_pay=participant.crt_pay, subtraction_pay=participant.subtraction_pay, subtraction_rep=subtraction_rep, audiopay=participant.audio_pay, raven_points=participant.raven_pay, raven_correct=participant.raven_selection, pfee=pfee, total=total, sft_pay=participant.sft_pay, ) page_sequence = [GoToSummary, Summary]