from otree.api import * c = cu doc = 'Kwestionariusz dotyczący wrażliwości na kontrast, wymiany, kwestionariusz osobowy, zapisanie zmiennych' class Constants(BaseConstants): name_in_url = 'kwestionariusz_kw' players_per_group = None num_rounds = 1 class Subsession(BaseSubsession): pass def przypisania(group): for p in group.get_players(): # Pierwsze 3 linijki tylko do testowania samego kwestionariusza # p.participant.vars['Zarobki1'] = 20 # p.participant.vars['Zarobki2'] = 69 # p.participant.vars['Kategoria'] =1 p.Zarobki1_z = p.participant.vars['Zarobki1'] p.Zarobki2_z = p.participant.vars['Zarobki2'] p.Kategoria_z = p.participant.vars['Kategoria'] class Group(BaseGroup): przypisania = przypisania class Player(BasePlayer): k_1 = models.IntegerField(choices=[[1, '1'], [2, '2'], [3, '3'], [4, '4'], [5, '5'], [6, '6'], [7, '7']], widget=widgets.RadioSelectHorizontal) k_2 = models.IntegerField(choices=[[1, '1'], [2, '2'], [3, '3'], [4, '4'], [5, '5'], [6, '6'], [7, '7']], widget=widgets.RadioSelectHorizontal) k_3 = models.IntegerField(choices=[[1, '1'], [2, '2'], [3, '3'], [4, '4'], [5, '5'], [6, '6'], [7, '7']], widget=widgets.RadioSelectHorizontal) k_4 = models.IntegerField(choices=[[1, '1'], [2, '2'], [3, '3'], [4, '4'], [5, '5'], [6, '6'], [7, '7']], widget=widgets.RadioSelectHorizontal) k_5 = models.IntegerField(choices=[[1, '1'], [2, '2'], [3, '3'], [4, '4'], [5, '5'], [6, '6'], [7, '7']], widget=widgets.RadioSelectHorizontal) k_6 = models.IntegerField(choices=[[1, '1'], [2, '2'], [3, '3'], [4, '4'], [5, '5'], [6, '6'], [7, '7']], widget=widgets.RadioSelectHorizontal) k_7 = models.IntegerField(choices=[[1, '1'], [2, '2'], [3, '3'], [4, '4'], [5, '5'], [6, '6'], [7, '7']], widget=widgets.RadioSelectHorizontal) k_8 = models.IntegerField(choices=[[1, '1'], [2, '2'], [3, '3'], [4, '4'], [5, '5'], [6, '6'], [7, '7']], widget=widgets.RadioSelectHorizontal) rokU = models.IntegerField(label='Rok urodzenia', max=2004, min=1900) rokS = models.IntegerField(label='Rok studiów', max=9, min=1) TrybS = models.StringField(label='Tryb studiów') Kierunek = models.StringField(label='Kierunek studiów') Sex = models.IntegerField(choices=[[1, 'kobieta'], [2, 'mężczyzna']], label='Płeć', widget=widgets.RadioSelectHorizontal) Zarobki1_z = models.FloatField() Zarobki2_z = models.FloatField() Kategoria_z = models.IntegerField() k_9 = models.IntegerField(choices=[[1, '1'], [2, '2'], [3, '3'], [4, '4'], [5, '5'], [6, '6'], [7, '7']], widget=widgets.RadioSelectHorizontal) w_11 = models.IntegerField(choices=[[1, '1'], [2, '2'], [3, '3'], [4, '4'], [5, '5'], [6, '6'], [7, '7']], widget=widgets.RadioSelectHorizontal) w_1 = models.IntegerField(choices=[[1, '1'], [2, '2'], [3, '3'], [4, '4'], [5, '5'], [6, '6'], [7, '7']], label='', widget=widgets.RadioSelectHorizontal) w_2 = models.IntegerField(choices=[[1, '1'], [2, '2'], [3, '3'], [4, '4'], [5, '5'], [6, '6'], [7, '7']], widget=widgets.RadioSelectHorizontal) w_3 = models.IntegerField(choices=[[1, '1'], [2, '2'], [3, '3'], [4, '4'], [5, '5'], [6, '6'], [7, '7']], widget=widgets.RadioSelectHorizontal) w_4 = models.IntegerField(choices=[[1, '1'], [2, '2'], [3, '3'], [4, '4'], [5, '5'], [6, '6'], [7, '7']], widget=widgets.RadioSelectHorizontal) w_5 = models.IntegerField(choices=[[1, '1'], [2, '2'], [3, '3'], [4, '4'], [5, '5'], [6, '6'], [7, '7']], widget=widgets.RadioSelectHorizontal) w_6 = models.IntegerField(choices=[[1, '1'], [2, '2'], [3, '3'], [4, '4'], [5, '5'], [6, '6'], [7, '7']], widget=widgets.RadioSelectHorizontal) w_7 = models.IntegerField(choices=[[1, '1'], [2, '2'], [3, '3'], [4, '4'], [5, '5'], [6, '6'], [7, '7']], widget=widgets.RadioSelectHorizontal) w_8 = models.IntegerField(choices=[[1, '1'], [2, '2'], [3, '3'], [4, '4'], [5, '5'], [6, '6'], [7, '7']], widget=widgets.RadioSelectHorizontal) w_9 = models.IntegerField(choices=[[1, '1'], [2, '2'], [3, '3'], [4, '4'], [5, '5'], [6, '6'], [7, '7']], widget=widgets.RadioSelectHorizontal) w_10 = models.IntegerField(choices=[[1, '1'], [2, '2'], [3, '3'], [4, '4'], [5, '5'], [6, '6'], [7, '7']], widget=widgets.RadioSelectHorizontal) device = models.IntegerField(choices=[[1, 'Komputera (stacjonarnego lub laptopa)'], [2, 'Tabletu'], [3, 'Smartfona']], label='Jakiego urządzenia używałeś(aś), biorąc udział w eksperymencie?', widget=widgets.RadioSelect) w_12 = models.IntegerField(choices=[[1, '1'], [2, '2'], [3, '3'], [4, '4'], [5, '5'], [6, '6'], [7, '7']], widget=widgets.RadioSelectHorizontal) w_13 = models.IntegerField(choices=[[1, '1'], [2, '2'], [3, '3'], [4, '4'], [5, '5'], [6, '6'], [7, '7']], widget=widgets.RadioSelectHorizontal) w_14 = models.IntegerField(choices=[[1, '1'], [2, '2'], [3, '3'], [4, '4'], [5, '5'], [6, '6'], [7, '7']], widget=widgets.RadioSelectHorizontal) class Zapisz_zmienne(WaitPage): after_all_players_arrive = przypisania body_text = 'Proszę czekać na pozostałych uczestników.' class Kontrast(Page): form_model = 'player' form_fields = ['k_1', 'k_2', 'k_3', 'k_4', 'k_9', 'k_5', 'k_6', 'k_7', 'k_8'] class Wymiana(Page): form_model = 'player' form_fields = ['w_1', 'w_2', 'w_3', 'w_4', 'w_5', 'w_6', 'w_7', 'w_8', 'w_9', 'w_10', 'w_11', 'w_12', 'w_13', 'w_14'] class Ankieta(Page): form_model = 'player' form_fields = ['rokU', 'rokS', 'TrybS', 'Kierunek', 'Sex', 'device'] class Podsumowanie(Page): form_model = 'player' @staticmethod def vars_for_template(player): participant = player.participant return dict( zarobil = participant.vars['Zarobki1']+participant.vars['Zarobki2'] ) page_sequence = [Zapisz_zmienne, Kontrast, Wymiana, Ankieta, Podsumowanie]