from otree.api import * import math import pandas as pd import itertools import numpy as np class C(BaseConstants): NAME_IN_URL = 'intro' PLAYERS_PER_GROUP = None NUM_ROUNDS = 1 INTRODUCTION_TEMPLATE = 'introduction/templates/intro.html' INFORMED_CONSENT_TEMPLATE = 'introduction/templates/informed_consent.html' TASK1_INSTRUCTIONS = "introduction/templates/svo_instructions.html" FOCUS_PLEDGE_TEMPLATE = "introduction/templates/focus_pledge.html" ECUS_PER_POUND = 25 POUNDS_PER_ECU = 1/ECUS_PER_POUND MAX_ECUS_TASK = 100 MAX_POUND_PAYOFF = 4 class Subsession(BaseSubsession): pass def creating_session(subsession): pass class Group(BaseGroup): pass class Player(BasePlayer): signed_informed_consent = models.BooleanField( label="Check this box if you agree with these conditions", initial = False ) focus_pledge = models.BooleanField(initial = False) prolific_id = models.StringField(default=str(" ")) # FUNCTIONS # PAGES class Introduction(Page): @staticmethod def is_displayed(player: Player): return True @staticmethod def before_next_page(self, timeout_happened): self.prolific_id = self.participant.label class InformedConsent(Page): @staticmethod def is_displayed(player: Player): return True @staticmethod def live_method(player, data): player.signed_informed_consent = data class Task1_Instructions(Page): @staticmethod def is_displayed(player: Player): return True class FocusPledge(Page): @staticmethod def is_displayed(player: Player): return True @staticmethod def live_method(player, data): player.focus_pledge = data @staticmethod def before_next_page(player, timeout_happened): player.participant.completion_status = "incomplete" page_sequence = [InformedConsent, FocusPledge, Introduction, Task1_Instructions]