from otree.api import Currency as c, currency_range from ._builtin import Page, WaitPage from .models import Constants import random class News(Page): form_model = 'player' form_fields = ['puzzle_solution', 'puzzle_confidence'] def vars_for_template(self): return { 'Industry_1': self.player.participant.vars['industries']['Industry_1']['name'], 'Industry_2': self.player.participant.vars['industries']['Industry_2']['name'], 'news_1_1': self.player.participant.vars['industries']['Industry_1']['news'][1], 'news_1_2': self.player.participant.vars['industries']['Industry_1']['news'][2], 'news_1_3': self.player.participant.vars['industries']['Industry_1']['news'][3], 'news_1_4': self.player.participant.vars['industries']['Industry_1']['news'][4], 'news_2_1': self.player.participant.vars['industries']['Industry_2']['news'][1], 'news_2_2': self.player.participant.vars['industries']['Industry_2']['news'][2], 'news_2_3': self.player.participant.vars['industries']['Industry_2']['news'][3], 'news_2_4': self.player.participant.vars['industries']['Industry_2']['news'][4], 'bonus': c(self.session.vars['bonus']['elicit']) } def before_next_page(self): self.player.participant.vars['industries']['puzzle_solution'] = self.player.puzzle_solution self.player.participant.vars['industries']['puzzle_confidence'] = self.player.puzzle_confidence class Industries(Page): form_model = 'player' form_fields = ['puzzle_1', 'puzzle_2', 'puzzle_3'] def vars_for_template(self): return { 'Industry_1': self.player.participant.vars['industries']['Industry_1']['name'], 'Industry_2': self.player.participant.vars['industries']['Industry_2']['name'], 'dexter': Constants.pictures['dexter'], 'mandark': Constants.pictures['mandark'], 'question_1': Constants.questions['q1']['text'], 'question_2': Constants.questions['q2']['text'], 'question_3': Constants.questions['q3']['text'], } class Report(Page): form_model = 'player' form_fields = ['puzzle_confidence'] def vars_for_template(self): return { 'dexter': Constants.pictures['dexter'], 'mandark': Constants.pictures['mandark'], 'bonus': c(self.session.vars['bonus']['elicit']) } def before_next_page(self): self.player.participant.vars['industries']['puzzle_solution'] = self.player.puzzle_solution self.player.participant.vars['industries']['puzzle_confidence'] = self.player.puzzle_confidence page_sequence = [ # News Industries, Report ]