from otree.api import Currency as c, currency_range from ._builtin import Page, WaitPage from .models import Constants import re class Question(Page): form_model = 'player' form_fields = ['submitted_answer'] def vars_for_template(self): lastnormalroundnum=str(self.session.vars['total_number_rounds_game']-self.session.vars['number_last_rounds_game']) return {'QuestionText': re.sub('lastnormalroundnum',lastnormalroundnum,self.player.question)} class Correction(Page): def vars_for_template(self): lastnormalroundnum=str(self.session.vars['total_number_rounds_game']-self.session.vars['number_last_rounds_game']) return {'QuestionText': re.sub('lastnormalroundnum',lastnormalroundnum,self.player.question), 'CorrectionText': re.sub('lastnormalroundnum',lastnormalroundnum,self.player.correction)} # For the treatment with one advisor there are less questions. This jump to the # game when the questions are over. def app_after_this_page(self, upcoming_apps): if self.player.participant.vars['treatment'] in ['1A','1B'] and self.player.round_number==Constants.nQ_T1: return upcoming_apps[0] page_sequence = [ Question, Correction ]