from otree.api import Currency as c, currency_range from ._builtin import Page, WaitPage from .models import Constants class Welcome(Page): def vars_for_template(self): return {'treatment': Constants.treatment} class Question1(Page): def vars_for_template(self): return {'treatment': Constants.treatment} form_model = 'player' form_fields = ['question1'] def error_message(self, values): if values['question1'] == 0: return "Your answer is not correct. Setting a funding target higher than your costs avoids making a loss." pass class Question2(Page): def vars_for_template(self): return {'treatment': Constants.treatment} form_model = 'player' form_fields = ['question2'] def error_message(self, values): if values['question2'] == 1: return "Your answer is not correct. The entrepreneur will sell the good in the aftermarket, if the campaign is a success and if he decides to produce." pass class Question3(Page): def vars_for_template(self): return {'treatment': Constants.treatment} form_model = 'player' form_fields = ['question3'] def error_message(self, values): if values['question3'] == 1: # and self.group.PledgeCap == 0: return "Your answer is not correct. The entrepreneur will be informed about the number of consumers who pledged." # elif values['question3'] == 0 and self.group.PledgeCap == 1: # return "Your answer is not correct. The entrepreneur will not be informed about the number of consumers who pledged." pass class Question4(Page): def vars_for_template(self): return {'treatment': Constants.treatment} form_model = 'player' form_fields = ['question4'] def error_message(self, values): if values['question4'] == 1: return "Your answer is not correct. The entrepreneur may be caught with a chance of 25%." pass class Question5(Page): def vars_for_template(self): return {'treatment': Constants.treatment} form_model = 'player' form_fields = ['question5'] def error_message(self, values): if values['question5'] == 0: return "Your answer is not correct. If the entrepreneur decides to run, the consumers make a loss." pass class Question6(Page): def vars_for_template(self): return {'treatment': Constants.treatment} form_model = 'player' form_fields = ['question6'] def error_message(self, values): if values['question6'] == 0: return "Your answer is not correct. The price is fixed at 10." pass class Role(Page): def vars_for_template(self): return {'treatment': Constants.treatment} def before_next_page(self): self.group.set_conditions() class TargetChoice(Page): def vars_for_template(self): return {'treatment': Constants.treatment} form_model = 'player' form_fields = ['decision_target'] def error_message(self, values): if values['decision_target'] == 0: return "Your funding target has to be greater than 0. Please adjust!" def before_next_page(self): self.player.set_values() class CampaignResult(Page): def vars_for_template(self): return {'treatment': Constants.treatment} class ProductionChoice(Page): def vars_for_template(self): return { 'treatment': Constants.treatment, 'aftermarket': self.player.total_aftermarket, 'amount': self.player.total_amount } form_model = 'player' form_fields = ['decision_production'] def is_displayed(self) -> bool: return self.player.campaign_funded == 1 class RunInfoCaught(Page): def vars_for_template(self): return {'treatment': Constants.treatment} def is_displayed(self) -> bool: return self.player.campaign_funded == 1 and self.player.decision_production == 1 class ProductionInfo(Page): def vars_for_template(self): return {'treatment': Constants.treatment} def is_displayed(self) -> bool: return self.player.campaign_funded == 1 and self.player.decision_production == 0 class ResultsPrep(Page): def before_next_page(self): self.player.set_payoffs() class Results(Page): # self.player.set_payoffs() pass class Questionnaire(Page): form_model = 'player' form_fields = ['survey_easy_difficult', 'survey_risk', 'strategy_e', 'age', 'gender', 'feedback'] pass class Bye(Page): pass page_sequence = [Welcome, Question1, Question2, Question3, Question4, Question5, Question6, Role, TargetChoice, CampaignResult, ProductionChoice, RunInfoCaught, ProductionInfo, ResultsPrep, Results, Questionnaire, Bye ]