from otree.api import Currency as c, currency_range from . import models from ._builtin import Page, WaitPage from .models import Constants import random from random import shuffle import itertools from decimal import * import time def vars_for_all_templates(self): return { 'condition': self.participant.vars['condition'] } class Instructions(Page): form_model = models.Player form_fields = ['first_name', 'last_name'] def before_next_page(self): # Bring vars forward to this app self.player.condition = self.participant.vars['condition'] class PreDecoding(Page): def vars_for_template(self): return { 'decode_strings': models.DecodeStrings.objects.filter(id__range=[1, 10]) } class Results1(Page): pass class Results2(Page): pass class DecodingTask1(Page): def vars_for_template(self): return { 'decode_strings': models.DecodeStrings.objects.filter(id__range=[11, 210]) } form_model = models.Player form_fields = ['num_attempted_1', 'num_decoded_1'] class DecodingTask2(Page): def vars_for_template(self): return { 'decode_strings': models.DecodeStrings.objects.filter(id__range=[211, 410]) } form_model = models.Player form_fields = ['num_attempted_2', 'num_decoded_2'] class PEQ(Page): form_model = models.Player form_fields = ['peq_task_difficulty', 'peq_task_enjoyment', 'peq_average', 'peq_affect_excited', 'peq_affect_upset', 'peq_affect_proud', 'peq_affect_irritable', 'peq_affect_inspired', 'peq_affect_nervous', 'peq_gender', 'peq_major' ] class ExitResults(Page): pass page_sequence = [ Instructions, PreDecoding, DecodingTask1, Results1, DecodingTask2, Results2, PEQ, ExitResults ]