from otree.api import Currency as c, currency_range from ._builtin import Page, WaitPage from .models import Constants import time import random class MyPage(Page): pass class ResultsWaitPage(WaitPage): pass class Results(Page): pass class Instructions(Page): form_model = 'player' form_fields = ['total_seconds'] class Example(Page): pass class ExampleTask(Page): form_model = 'player' form_fields = ['example_task'] def vars_for_template(self): return { 'answer_range': list(range(-250, 300, 50)), #'answer_range': self.session.config['answer_range'] # 'first_order_only': self.session.config['panama_lab_experiment'], 'prize': 15, } def before_next_page(self): self.participant.vars['example_task'] = self.player.example_task class ExampleTask2(Page): pass class Instructions2(Page): pass class FirstOrderAbility(Page): form_model = 'player' form_fields = ['first_order_ability','current_task'] timeout_seconds = 300 def vars_for_template(self): return { 'answer_range': list(range(-5, 6, 1)), #'answer_range': self.session.config['answer_range'] # 'first_order_only': self.session.config['panama_lab_experiment'], 'prize': 15, } def before_next_page(self): self.participant.vars['first_order_ability'] = self.player.first_order_ability class NextActivity(Page): pass class FirstOrderPreferences(Page): form_model = 'player' form_fields = ['first_order_preferences','current_task'] timeout_seconds = 300 def vars_for_template(self): return { 'answer_range': list(range(-5, 6, 1)), #'answer_range': self.session.config['answer_range'] # 'first_order_only': self.session.config['panama_lab_experiment'], 'prize': 15, } def before_next_page(self): self.participant.vars['first_order_ability'] = self.player.first_order_ability class Demographics(Page): form_model = 'player' form_fields = ['provider', 'gender','rand_task', 'rand_num','payout_prob','payout','total_seconds','rand_task_int','difference'] class Payout(Page): pass taskrand =[FirstOrderAbility, FirstOrderPreferences] random.shuffle(taskrand) page_sequence = [Instructions, Example, ExampleTask, ExampleTask2, Instructions2, taskrand[0], NextActivity, taskrand[1], Demographics, Payout]