from otree.api import Currency as c, currency_range from ._builtin import Page, WaitPage from .models import Constants from math import ceil class InstructionsGeneral(Page): def vars_for_template(self) -> dict: return { 'participation_fee': self.session.config['participation_fee'] } class InstructionsCombined(Page): form_model = 'player' def get_form_fields(self): if self.subsession.persistent: return ['c_rounds', 'c_tokens', 'c_remaining_tokens', 'c_shared_pot', 'c_shared_pot_end_of_game'] else: return ['c_rounds', 'c_tokens', 'c_remaining_tokens', 'c_shared_pot'] def vars_for_template(self) -> dict: if self.subsession.persistent: ot_gen = Constants.MPCR_TOTAL * Constants.PERSISTENT_DEPRECIATION * self.subsession.group_size else: ot_gen = Constants.MPCR_TOTAL * self.subsession.group_size return { 'blue_token_loss': round(Constants.PERSISTENT_DEPRECIATION, 2), 'blue_token_loss_ten': round(Constants.PERSISTENT_DEPRECIATION*10, 2), 'orange_token_generation': round(ot_gen, 2) } page_sequence = [ InstructionsGeneral, InstructionsCombined ]