from otree.api import Currency as c, currency_range from ._builtin import Page, WaitPage from .models import Constants class Intro_Personnel(Page): pass class Control_Question(Page): form_model = 'player' form_fields = ['control1', 'control2', 'control3'] # Before the player reaches the next page, it is evaluated which questions were answered correctly def before_next_page(self): self.player.set_is_control1_correct() self.player.set_is_control2_correct() self.player.set_is_control3_correct() self.player.set_control_score() self.player.set_control_passed() class Candidates_TableSeg(Page): form_model = 'player' form_fields = ['choice1', 'choice2', 'choice3', 'complex_buildPortfolio', 'current_C1', 'all_C1', 'all_C2', 'all_C3'] class Portfolio_TableSeg(Page): form_model = 'player' form_fields = ['choice_selectPortfolio', 'complex_selectPortfolio', 'current_team', 'all_teams'] def before_next_page(self): # Before the player reaches the next page, the utility of his portfolio building is calculated for x in range(1, 10): if self.player.choice1 == x: self.player.u_buildPortfolio = self.player.u_buildPortfolio + Constants.candidate_utilities[x-1] if self.player.choice2 == x: self.player.u_buildPortfolio = self.player.u_buildPortfolio + Constants.candidate_utilities[x-1] if self.player.choice3 == x: self.player.u_buildPortfolio = self.player.u_buildPortfolio + Constants.candidate_utilities[x-1] # Before the player reaches the next page, the utility of his portfolio selection is calculated for i in range(1, 4): if self.player.choice_selectPortfolio == i: self.player.u_selectPortfolio = self.player.u_selectPortfolio + Constants.team_utilities[i-1] page_sequence = [Intro_Personnel, Control_Question, Candidates_TableSeg, Portfolio_TableSeg]