from otree.api import Currency as c, currency_range from ._builtin import Page, WaitPage from .models import Constants # Import the colrisk1 constants to use in the templates from colrisk1.models import Constants as colrisk1Constants # Import the set_endowments function from utils # We want to be able to test the apps seperately, so run this method from multiple apps import utils class SetEndowmentsWaitPage(WaitPage): def after_all_players_arrive(self): if self.group.round_number == 1: self.session.vars.update(total_pot=c(0)) utils.set_endowments(self.group) class GroupAssigned(Page): def vars_for_template(self): # Use the colrisk1Constants model imported from that app return {'colrisk1Constants':colrisk1Constants} class Instructions(Page): def vars_for_template(self): return {'colrisk1Constants': colrisk1Constants} class Quiz(Page): form_model = "player" form_fields = ["investment", "takehome", "p_ruin", "contributions_fair_p1", "contributions_fair_p2", "contributions_pred_p1", "contributions_pred_p2", "confidence"] class Results(Page): pass class FinalMessage(Page): pass page_sequence = [ SetEndowmentsWaitPage, GroupAssigned, Instructions, Quiz, Results, FinalMessage ]