from otree.api import Currency as c, currency_range from . import models from ._builtin import Page, WaitPage from .models import Constants def vars_for_all_templates(self): """ get variables from session configs level """ return { 'task': self.player.task_identifier, 'round': self.round_number, 'round_risk': self.round_number - Constants.intertemporal_rounds - Constants.cons_choice_rounds, 'round_wine': self.round_number - Constants.intertemporal_rounds, } class WelcomeTime(Page): def is_displayed(self): return self.round_number == 1 class WelcomeRisk(Page): def is_displayed(self): return self.round_number == Constants.intertemporal_rounds + Constants.cons_choice_rounds + 1 class Intertemporal(Page): def is_displayed(self): return self.round_number <= Constants.intertemporal_rounds form_model = models.Player form_fields = [ 'choice_time', ] class Risk(Page): def is_displayed(self): return self.round_number > Constants.intertemporal_rounds + Constants.cons_choice_rounds form_model = models.Player form_fields = [ 'choice_risk', ] class Wine(Page): def is_displayed(self): return Constants.intertemporal_rounds < self.round_number <= Constants.intertemporal_rounds + Constants.cons_choice_rounds form_model = models.Player form_fields = [ 'choice_wine', ] class Control(Page): def is_displayed(self): return self.round_number == Constants.num_rounds form_model = models.Player form_fields = [ 'control_time', 'control_probability', 'control_variable', ] class Wait(Page): timeout_seconds = 1 page_sequence = [ WelcomeTime, Intertemporal, WelcomeRisk, Risk, Wine, Wait, Control, ]