from otree.api import Currency as c, currency_range from ._builtin import Page, WaitPage from .models import Constants import random ############################################################ # INTRO AND INSTRUCTIONS ONLY IN ROUND 1 ############################################################ class Intro(Page): def is_displayed(self): return self.round_number == 1 def before_next_page(self): self.player.setting_() ############################################################ # DECISION ############################################################ class Decisions(Page): def is_displayed(self): self.player.fill_in_values() return True form_model = 'player' form_fields = ['trust_'] def vars_for_template(self): temp_html = [(Constants.competitiveness_score, self.participant.vars['cases'][self.round_number - 1][0]), (Constants.openness_score, self.participant.vars['cases'][self.round_number - 1][1]), (Constants.conscentiousness_score, self.participant.vars['cases'][self.round_number - 1][2]), (Constants.agreeableness_score, self.participant.vars['cases'][self.round_number - 1][3]), (Constants.neuroticism_score, self.participant.vars['cases'][self.round_number - 1][4]), (Constants.extraversion_score, self.participant.vars['cases'][self.round_number - 1][5]), (Constants.gender, Constants.choicesGender[self.participant.vars['cases'][self.round_number - 1][6]-1][1]), (Constants.risk_, self.participant.vars['cases'][self.round_number - 1][7]), (Constants.impat_, self.participant.vars['cases'][self.round_number - 1][8]), (Constants.age_, Constants.age[self.participant.vars['cases'][self.round_number - 1][9]][1]), (Constants.sob_, Constants.state_birth[self.participant.vars['cases'][self.round_number - 1][10]][1]), (Constants.lang_, Constants.home_language[self.participant.vars['cases'][self.round_number - 1][11]][1])] temp_string = '' for j in temp_html: temp_string += '' + j[0] + ' ' + str(j[1]) + '' return dict(x_ = temp_string) ############################################################ # QUESTIONNAIRE ############################################################ class Questionnaire(Page): def is_displayed(self): return self.round_number == Constants.num_rounds form_model = 'player' form_fields = ['female', 'academic', 'age'] ############################################################ # SEQUENCE OF PAGES ############################################################ # Question, page_sequence = [ Intro, Decisions, Questionnaire]