from otree.api import Currency as c, currency_range from ._builtin import Page, WaitPage from .models import Constants from time import time class TaskRdDecision(Page): template_name = 'redistribute/RedistributeDecision.html' form_model = 'player' form_fields = ['redistribute_decision'] def vars_for_template(self): partner_treatment = self.player.redistribute_partner if partner_treatment == 'name': partners = f"Participant A is called {self.player.redistribute_partner_name_a}. " \ f"Participant B is called {self.player.redistribute_partner_name_b}." elif partner_treatment == 'same_class/other_school': partners = "Participant A is in your house. Participant B is in another house." elif partner_treatment == 'other_school/same_class': partners = "Participant A is in another house. Participant B is in your house." elif partner_treatment == 'same_region/other_region': partners = "Participant A is educated in the same house." \ "Participant B is educated in another house." else: partners = '' touch = False if self.participant.vars.get('is_mobile') or self.participant.vars.get('is_tablet'): touch = True return {'partners': partners, 'total_endowment': Constants.redistribute_endowment, 'touch': touch} page_sequence = [ TaskRdDecision ]