##################################################### ##################################################### # README # # Program Name: __init__.py # Purpose: Block mobile users. ##################################################### # # Author: Andrew Olsen # Date Created: 01.14.2025 # Last Updated: 01.14.2025 # ##################################################### #### Modules from otree.api import * import numpy as np c = cu doc = '' ## Copied from https://www.otreehub.com/code/ class C(BaseConstants): NAME_IN_URL = 'detect_mobile' PLAYERS_PER_GROUP = None NUM_ROUNDS = 1 class Subsession(BaseSubsession): pass class Group(BaseGroup): pass class Player(BasePlayer): is_mobile = models.BooleanField() # PAGES class MobileCheck(Page): form_model = 'player' form_fields = ['is_mobile'] # Send them to the end if they are mobile @staticmethod def app_after_this_page(player, upcoming_apps): participant = player.participant participant.is_mobile = player.is_mobile if player.is_mobile: ## Need to populate the passed_quiz variable participant.passed_quiz = True return upcoming_apps[-1] page_sequence = [MobileCheck]