from otree.api import * import random doc = """ Feedback """ class C(BaseConstants): NAME_IN_URL = 'feedback' PLAYERS_PER_GROUP = 2 NUM_ROUNDS = 1 class Subsession(BaseSubsession): pass def creating_session(subsession): for player in subsession.get_players(): player.random_signal = random.choice(['yes', 'no']) class Group(BaseGroup): pass class Player(BasePlayer): random_signal = models.StringField(initial=None) #newsevaluation = models.IntegerField( #label=''' #How would you rate the accuracy of the information on a scale from 0 (false) to 100 (true)? #''', min=0, max=100 #) eva = models.IntegerField( label=''' How would you rate the accuracy of this information on a scale from 0 (false) to 100 (true)? ''', min=0, max=100 ) # FUNCTIONS # PAGES class Introduction(Page): pass class feedback(Page): form_model = 'player' form_fields = ['eva'] #form_fields = ['newsevaluation', 'eva'] @staticmethod def before_next_page(player: Player, timeout_happened): import random player.random_signal = random.choice(['yes', 'no']) print("Debug: Set player.random_signal =", player.random_signal) page_sequence = [Introduction, feedback]