from otree.api import Currency as c, currency_range from . import models from otreeutils.pages import AllGroupsWaitPage, ExtendedPage, UnderstandingQuestionsPage, APPS_DEBUG from otreeutils.surveys import SurveyPage, setup_survey_pages from otree.api import Page, WaitPage from .models import Constants import random import settings import time def vars_for_all_templates(self): pmat = Constants.payoff_matrix[self.participant.vars['treatment']] return { 'pmat': pmat, } class Reason1(Page): form_model = 'player' form_fields = ['inequality_aversion1', 'other_defection1', 'higher_payoff1'] def is_displayed(self): self.participant.vars['reason1_starting_time1'] = time.time() if (self.participant.vars['treatment'] == 'EQ-H') or (self.participant.vars['treatment'] == 'EQ-L'): self.player.experiment_time = time.time() - self.participant.vars['experiment_starting_time'] # print('SurveyPage2',self.participant.vars['treatment'],self.participant.vars['treatment'] == 'UNEQ') return self.participant.vars['treatment'] == 'UNEQ' class Reason1g(Page): form_model = 'player' form_fields = ['inequality_aversion1g', 'other_defection1g', 'higher_payoff1g'] class Reason(Page): form_model = 'player' form_fields = ['inequality_aversion', 'other_defection', 'higher_payoff'] class Reasong(Page): form_model = 'player' form_fields = ['inequality_aversiong', 'other_defectiong', 'higher_payoffg'] class Results(Page): pass page_sequence = [Reason1,Reason1g,]