File size: 1,405 Bytes
3209e11 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 | 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
]
|