from otree.api import Currency as c, currency_range from ._builtin import Page, WaitPage from .models import Constants class Intro(Page): pass class SliderPage(Page): form_model = 'player' def vars_for_template(self): touch = False if self.participant.vars.get('is_mobile') or self.participant.vars.get('is_tablet'): touch = True template_vars = { 'touch': touch, 'min_label': self.min_label, 'max_label': self.max_label } return template_vars class Risk(SliderPage): min_label = '0 box' max_label = '10 boxes' form_fields = ['avg_open', 'avg_open_girls', 'avg_open_boys', 'should_open', 'should_open_girls', 'should_open_boys'] class Present(SliderPage): min_label = '0 credit' max_label = '5 credits' form_fields = ['avg_invest', 'avg_invest_girls', 'avg_invest_boys', 'should_invest', 'should_invest_girls', 'should_invest_boys'] class Grit(SliderPage): min_label = '0%' max_label = '100%' form_fields = ['avg_grit', 'avg_grit_girls', 'avg_grit_boys', 'should_grit', 'should_grit_girls', 'should_grit_boys'] class Altruism(SliderPage): min_label = '0 credit' max_label = '10 credits' form_fields = ['avg_altruism_give', 'avg_altruism_give_girls', 'avg_altruism_give_boys', 'should_altruism_give', 'should_altruism_give_girls', 'should_altruism_give_boys'] class Trust(SliderPage): min_label = '0 credit' max_label = '5 credits' form_fields = ['avg_trust_give', 'avg_trust_give_girls', 'avg_trust_give_boys', 'should_trust_give', 'should_trust_give_girls', 'should_trust_give_boys'] class Redistribution(SliderPage): min_label = '0 credit' max_label = '10 credits' form_fields = ['avg_redistribution_give', 'avg_redistribution_give_girls', 'avg_redistribution_give_boys', 'should_redistribution_give', 'should_redistribution_give_girls', 'should_redistribution_give_boys'] class Cooperation(SliderPage): min_label = '0 credit' max_label = '1 credit' form_fields = ['avg_coop_give', 'avg_coop_give_girls', 'avg_coop_give_boys', 'should_coop_give', 'should_coop_give_girls', 'should_coop_give_boys'] class Competition(SliderPage): min_label = '0%' max_label = '100%' form_fields = ['avg_competitiveness', 'avg_competitiveness_girls', 'avg_competitiveness_boys', 'should_competitiveness', 'should_competitiveness_girls', 'should_competitiveness_boys'] class TraitRating(Page): form_model = 'player' form_fields = ['risk_rating', 'present_rating', 'grit_rating', 'altruism_rating', 'trust_rating', 'redistribution_rating', 'cooperation_rating', 'competition_rating'] class TraitChange(Page): form_model = 'player' form_fields = ['risk_change', 'present_change', 'grit_change', 'altruism_change', 'trust_change', 'redistribution_change', 'cooperation_change', 'competition_change'] class TraitChangeConfidence(Page): form_model = 'player' form_fields = ['risk_change_confidence', 'present_change_confidence', 'grit_change_confidence', 'altruism_change_confidence', 'trust_change_confidence', 'redistribution_change_confidence', 'cooperation_change_confidence', 'competition_change_confidence'] class TraitChangeHome(Page): form_model = 'player' form_fields = ['risk_change_home', 'risk_change_home_comment', 'present_change_home', 'present_change_home_comment', 'grit_change_home', 'grit_change_home_comment', 'altruism_change_home', 'altruism_change_home_comment', 'trust_change_home', 'trust_change_home_comment', 'redistribution_change_home', 'redistribution_change_home_comment', 'cooperation_change_home', 'cooperation_change_home_comment', 'competition_change_home', 'competition_change_home_comment'] class TraitDiscussedWith(Page): form_model = 'player' form_fields = ['risk_discussed_with', 'present_discussed_with', 'grit_discussed_with', 'altruism_discussed_with', 'trust_discussed_with', 'redistribution_discussed_with', 'cooperation_discussed_with', 'competition_discussed_with'] class TraitFrequency(Page): form_model = 'player' form_fields = ['risk_frequency', 'present_frequency', 'grit_frequency', 'altruism_frequency', 'trust_frequency', 'redistribution_frequency', 'cooperation_frequency', 'competition_frequency'] class TraitImportance(Page): form_model = 'player' form_fields = ['risk_importance', 'present_importance', 'grit_importance', 'altruism_importance', 'trust_importance', 'redistribution_importance', 'cooperation_importance', 'competition_importance'] page_sequence = [Intro, Risk, Present, Grit, Altruism, Trust, Redistribution, Cooperation, Competition, TraitRating, TraitChange, TraitChangeConfidence, TraitChangeHome, TraitDiscussedWith, TraitFrequency, TraitImportance]