from real_effort import get_task_module import random from .profile_pictures import PROFILE_PICTURES NUM_ROUNDS = 3 MIN_ON_CHAT = 3 PSEUDONYMS = [f"pseudonym{i}" for i in range(574)] # TODO: SET CORRECT COMPLETION CODE cc PROLIFIC_URL = "https://app.prolific.co/submissions/complete?cc=CWCHBSJT" NOCPARTNER_URL = "https://app.prolific.com/submissions/complete?cc=C19Y3UZE" COMPLETION_FEE = 6 NOCPARTNER_FEE = 6 def get_receiver_key(receiver_session_code, receiver_id): """This key is used to access receiver info saved in the session""" return f"{receiver_session_code}-{receiver_id}" def set_dropout(player, msg: str): participant = player.participant participant.is_dropout = True player.participant.dropout_msg = msg player.payoff = 0 def is_dropout(player): return player.participant.is_dropout def get_task_name(player) -> str: return get_task_module(player).NAME def set_info(players, set_reward: bool = True): # Fetch name and profile_picture from display data of participant for p in players: participant = p.participant display_info = participant.display_info if not display_info: display_info = dict(name=random.choice(PSEUDONYMS), profile_picture=random.choice(PROFILE_PICTURES)) participant.display_info = display_info # Set name, profile_picture, reward_group and reward of each player p.name = display_info["name"] p.profile_picture = display_info["profile_picture"] p.reward_group = str(p.participant.reward_group) if set_reward: p.reward = p.participant.rewards[p.round_number - 1]