from otree.api import * doc = """ Your app description """ # Note: As an app, using "app_after_this_page" gives an error if the entered value is more than 5 dollars # This app runs properly when combined with another app class Constants(BaseConstants): name_in_url = 'videoActivity' players_per_group = None num_rounds = 1 class Subsession(BaseSubsession): pass class Group(BaseGroup): pass class Player(BasePlayer): # Ask the participant for the number of dollars he/she is willing to value user_payment = models.IntegerField(label="How much do you value this activity in terms of dollars?") # PAGES class IntroductionPage(Page): pass class CounterOfferPage(Page): # @staticmethod # def is_displayed(player: Player): # return player.round_number == 1 form_model = "player" form_fields = ["user_payment"] # skips the entire app if the user puts an amount greater than 5 dollars def app_after_this_page(player, upcoming_apps): if player.user_payment > 5: return upcoming_apps[0] class VideoPage(Page): # # Display this page only if paricipant payment is less than or equal to 5. # @staticmethod # def is_displayed(player): # if player.round_number == 1: # if player.user_payment <= 5: # return True # else: # return False pass class ResultsPage(Page): # # Display this page only if paricipant payment is less than or equal to 5. # @staticmethod # def is_displayed(player): # if player.round_number == 1: # if player.user_payment <= 5: # return True # else: # return False pass class DisagreePage(Page): # # Display this page only if paricipant payment is greater than 5. # @staticmethod # def is_displayed(player): # if player.round_number == 1: # if player.user_payment > 5: # return True # else: # return False pass page_sequence = [IntroductionPage, CounterOfferPage, VideoPage, ResultsPage]