from otree.api import * import random doc = """ """ class C(BaseConstants): NAME_IN_URL = 'collaboration' PLAYERS_PER_GROUP = None NUM_ROUNDS = 1 MISLEADING = [ dict(name='factualError', label="It contains a factual error"), dict(name='manipulatedMedia', label="It contains manipulated media"), dict(name='outdatedInformation', label="It contains outdated information that may be misleading"), dict(name='misrepresentation', label="It is a misrepresentation or missing important context"), dict(name='disputedClaim', label="It presents a disputed claim as fact"), dict(name='satire', label="It is satire/a joke that may be misinterpreted"), dict(name='other', label="Other"), ] NOT_MISLEADING = [ dict(name='factualCorrect', label="It expresses a factually correct claim"), dict(name='outdated', label="The tweet was correct when written, but is out of date now"), dict(name='joking', label="It is clearly satirical/joking"), dict(name='personalOpinion', label="It expresses a personal opinion"), dict(name='otherNOTMIS', label="Other"), ] ONLINE_ACTIVITY = [ dict(name='wikipedia', label="Editing Wikipedia"), dict(name='onlineReview', label="Leaving a review for a business on Yelp, Google Maps, etc."), dict(name='factCheck', label="Fact-checking an online content"), dict(name='newsWebsite', label="Leaving a comment on a news website"), dict(name='userContent', label="Contributed to any other user-generated content"), ] class Subsession(BaseSubsession): pass class Group(BaseGroup): pass class Player(BasePlayer): # FOR MISLEADING.HTML fewBelieve = models.BooleanField( label="If the tweet was widely spread, its message would likely be believed by:", choices=[[True, 'Few'], [False, 'Many']], ) littleHarm = models.BooleanField( label="If many believed the tweet, it might cause:", choices=[[True, 'Little harm'], [False, 'Considerable harm']], ) easyInfo = models.BooleanField( label="Finding and understanding the correct information would be:", choices=[[True, 'Easy'], [False, 'Challenging']], ) factualError = models.BooleanField(blank=True) manipulatedMedia = models.BooleanField(blank=True) outdatedInformation = models.BooleanField(blank=True) misrepresentation = models.BooleanField(blank=True) disputedClaim = models.BooleanField(blank=True) satire = models.BooleanField(blank=True) other = models.BooleanField(blank=True) # FOR notMISLEADING.HTML factualCorrect = models.BooleanField(blank=True) outdated = models.BooleanField(blank=True) joking = models.BooleanField(blank=True) personalOpinion = models.BooleanField(blank=True) otherNOTMIS = models.BooleanField(blank=True) # FOR COLLABORATIONeval.HTML wikipedia = models.BooleanField(blank=True) onlineReview = models.BooleanField(blank=True) factCheck = models.BooleanField(blank=True) newsWebsite = models.BooleanField(blank=True) userContent = models.BooleanField(blank=True) collabEval = models.IntegerField( label="How easy was it for you to come up with a text both of you agreed with?", choices=[ [1, 'Extremely easy'], [2, 'Somewhat easy'], [3, 'Somewhat difficult'], [4, 'Extremely difficult'], ] ) # FUNCTIONS def other_player(player: Player): return player.get_others_in_group()[0] # PAGES class Misleading(Page): # timeout_seconds = 300 form_model = 'player' @staticmethod def get_form_fields(player: Player): return [reason['name'] for reason in C.MISLEADING] + ['fewBelieve', 'littleHarm', 'easyInfo'] @staticmethod def is_displayed(player: Player): participant = player.participant if participant.evidenceEval and not participant.dropped: return True else: return False @staticmethod def before_next_page(player, timeout_happened): participant = player.participant if timeout_happened: participant.dropped = True else: participant.dropped = False class notMisleading(Page): # timeout_seconds = 300 form_model = 'player' @staticmethod def get_form_fields(player: Player): return [reason['name'] for reason in C.NOT_MISLEADING] @staticmethod def is_displayed(player: Player): participant = player.participant if not participant.evidenceEval and not participant.dropped: return True else: return False @staticmethod def before_next_page(player, timeout_happened): participant = player.participant if timeout_happened: participant.dropped = True else: participant.dropped = False class CollaborationEval(Page): timeout_seconds = 300 form_model = 'player' @staticmethod def is_displayed(player: Player): participant = player.participant if not participant.dropped: return True else: return False @staticmethod def get_form_fields(player: Player): return [online['name'] for online in C.ONLINE_ACTIVITY] + ['collabEval'] @staticmethod def before_next_page(player, timeout_happened): participant = player.participant if timeout_happened: participant.dropped = True else: participant.dropped = False class Drop(Page): @staticmethod def is_displayed(player: Player): participant = player.participant if participant.dropped: return True else: return False class Results(Page): form_model = 'player' def is_displayed(player: Player): participant = player.participant return participant.dropped == False @staticmethod def js_vars(player): return dict( completionlink= player.subsession.session.config['completionlink'] ) page_sequence = [Misleading, notMisleading, CollaborationEval, Results, Drop]