from otree.api import Currency as c, currency_range from ._builtin import Page, WaitPage from .models import Constants from random import shuffle, sample class ResultsWaitPage(WaitPage): pass class Instructions(Page): def is_displayed(self): return self.subsession.round_number == 1 class Cognitive_Load_Starter(Page): pass class Wait(Page): pass class Cognitive_Load(Page): form_model = 'player' class Cognitive_Load_Entry(Page): form_model = 'player' form_fields = ['cognitive_load_entry'] def before_next_page(self): self.player.set_payoff() class Results(Page): def is_displayed(self): return self.subsession.round_number == Constants.num_rounds def vars_for_template(self): player_in_all_rounds = self.player.in_all_rounds() total_payoff_load = sum([p.payoff_load for p in player_in_all_rounds]) return {'player_in_all_rounds': player_in_all_rounds, 'total_payoff_load': total_payoff_load, } class NormalWaitPage(WaitPage): title_text = "Bitte warten Sie" body_text = "Bitte warten Sie. Das Experiment geht gleich weiter." def is_displayed(self): return self.subsession.round_number == Constants.num_rounds page_sequence = [ Instructions, Cognitive_Load_Starter, Cognitive_Load, Wait, Cognitive_Load_Entry, NormalWaitPage ]