from ._builtin import Page, WaitPage import time, random from .models import Constants from django.utils.translation import ugettext as _ def vars_for_all_templates(self): return { 'fixed_payoff': Constants.fixed_payoff, 'completion_url': Constants.completion_url } # ******************************************************************************************************************** # # *** Instructions *** # # ******************************************************************************************************************** # class Welcome(Page): #template_name = 'transcription_task/ExplanationTask.html' def is_displayed(self): return self.player.round_number == 1 def vars_for_template(self): return { 'fixed_payoff': Constants.fixed_payoff, 'task_timer': Constants.task_timer, 'piece_rate': Constants.piece_rate, } # ******************************************************************************************************************** # # *** Consent *** # # ******************************************************************************************************************** # class Consent(Page): form_model = 'player' form_fields = ['consent', 'submit_noConsent'] # only display Consent Page in round 1 # ---------------------------------------------------------------------------------------------------------------- def is_displayed(self): return self.round_number == 1 def before_next_page(self): self.participant.vars['consent'] = self.player.consent # ******************************************************************************************************************** # # *** Demographics *** # # ******************************************************************************************************************** # class Demographics(Page): form_model = 'player' form_fields = ['gender', 'gender_others', 'age'] # only display Demographics Page in round 1 # ---------------------------------------------------------------------------------------------------------------- def is_displayed(self): return self.round_number == 1 # ******************************************************************************************************************** # # *** Instructions *** # # ******************************************************************************************************************** # class Instructions(Page): # only display instruction in round 1 # ---------------------------------------------------------------------------------------------------------------- def is_displayed(self): return self.round_number == 1 # ******************************************************************************************************************** # # *** TASK PAGE *** # # ******************************************************************************************************************** # class EnterSolution(Page): # form model # ---------------------------------------------------------------------------------------------------------------- form_model = 'player' # time text # ---------------------------------------------------------------------------------------------------------------- timer_text = 'Time left to complete as many tasks as possible:' def is_displayed(self): return self.player.round_number < Constants.num_training_rounds + 1 def vars_for_template(self): return {'letters_table': Constants.letter_table_study[self.player.round_number], 'code_table': Constants.code_table_study[self.player.round_number], 'round_number': self.player.round_number, 'solved_sofar': self.player.round_number - 1} page_sequence = [ Welcome, Consent, Demographics, Instructions, EnterSolution, ]