from otree.api import * import settings author = 'Patricia Zauchner (zauchner@uni-bremen.de)' doc = """ Introduction to the effort treatment. The idea of that combination of effort treatments is from Bernhard Kittel et al. The idea and design of showing the correct last count are taken from Curtis Kephart. """ class C(BaseConstants): NAME_IN_URL = 'effort_intro' PLAYERS_PER_GROUP = 5 # Not really necessary in effort tasks. But so it looks better in the data NUM_ROUNDS = 1 class Subsession(BaseSubsession): pass def creating_session(subsession: Subsession): # # Copy the group and player id structure of the first app if "id_matrix" in subsession.session.vars: subsession.set_group_matrix(subsession.session.vars['id_matrix']) else: subsession.group_randomly() # oTree function subsession.session.vars['id_matrix'] = subsession.get_group_matrix() print("ID Matrix created in app effort_intro", subsession.session.vars['id_matrix']) # # try: subsession.session.vars["do_effort_task"] = subsession.session.config["do_effort_task"] except KeyError: subsession.session.vars["do_effort_task"] = getattr(settings, "do_effort_task", True) # class Group(BaseGroup): pass class Player(BasePlayer): pass # Pages class EffortIntro(Page): """ Introduction to the effort task """ @staticmethod def is_displayed(player): return player.session.vars["do_effort_task"] def vars_for_template(player): # Check how many effort tasks are played in this experiment countingpointsThere = "DoEffort_Counting" in player.subsession.session.vars subpointsThere = "DoEffort_Sub" in player.subsession.session.vars addpointsThere = "DoEffort_Add" in player.subsession.session.vars trivialpointsThere = "DoEffort_Trivial" in player.subsession.session.vars sliderpointsThere = "DoEffort_Slider" in player.subsession.session.vars total = countingpointsThere + subpointsThere + addpointsThere + trivialpointsThere + sliderpointsThere return {"total": total} page_sequence = [ EffortIntro, ]