from otree.api import * c = cu doc = 'Kwestionariusz identyfikacji z grupą, kwestionariusz osobowy, zapisanie zmiennych' class Constants(BaseConstants): name_in_url = 'kwestionariusz_zmienne' players_per_group = None num_rounds = 1 class Subsession(BaseSubsession): pass def przypisania(group): for p in group.get_players(): p.Zarobki1_z = p.participant.vars['Zarobki1'] p.Zarobki2_z = p.participant.vars['Zarobki2'] p.Bonus1_z = p.participant.vars['Bonus1'] p.Bonus2_z = p.participant.vars['Bonus2'] p.Kategoria_z = p.participant.vars['Kategoria'] class Group(BaseGroup): przypisania = przypisania class Player(BasePlayer): GW_belong = models.IntegerField(choices=[[1, '1'], [2, '2'], [3, '3'], [4, '4'], [5, '5'], [6, '6'], [7, '7']], widget=widgets.RadioSelectHorizontal) GW_common = models.IntegerField(choices=[[1, '1'], [2, '2'], [3, '3'], [4, '4'], [5, '5'], [6, '6'], [7, '7']], widget=widgets.RadioSelectHorizontal) GW_liking = models.IntegerField(choices=[[1, '1'], [2, '2'], [3, '3'], [4, '4'], [5, '5'], [6, '6'], [7, '7']], widget=widgets.RadioSelectHorizontal) GW_close = models.IntegerField(choices=[[1, '1'], [2, '2'], [3, '3'], [4, '4'], [5, '5'], [6, '6'], [7, '7']], widget=widgets.RadioSelectHorizontal) GO_belong = models.IntegerField(choices=[[1, '1'], [2, '2'], [3, '3'], [4, '4'], [5, '5'], [6, '6'], [7, '7']], widget=widgets.RadioSelectHorizontal) GO_common = models.IntegerField(choices=[[1, '1'], [2, '2'], [3, '3'], [4, '4'], [5, '5'], [6, '6'], [7, '7']], widget=widgets.RadioSelectHorizontal) GO_liking = models.IntegerField(choices=[[1, '1'], [2, '2'], [3, '3'], [4, '4'], [5, '5'], [6, '6'], [7, '7']], widget=widgets.RadioSelectHorizontal) GO_close = 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=2003, 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() Bonus1_z = models.FloatField() Bonus2_z = models.FloatField() Kategoria_z = models.IntegerField() class Zapisz_zmienne(WaitPage): after_all_players_arrive = przypisania body_text = 'Proszę czekać na pozostałych uczestników.' class Grupa_wlasna(Page): form_model = 'player' form_fields = ['GW_belong', 'GW_common', 'GW_liking', 'GW_close'] class Grupa_obca(Page): form_model = 'player' form_fields = ['GO_belong', 'GO_common', 'GO_liking', 'GO_close'] class Ujawnienie_bonusy(Page): form_model = 'player' class Ankieta(Page): form_model = 'player' form_fields = ['rokU', 'rokS', 'TrybS', 'Kierunek', 'Sex'] class Podsumowanie(Page): form_model = 'player' @staticmethod def vars_for_template(player): participant = player.participant return dict( zarobil = participant.vars['Zarobki1']+participant.vars['Zarobki2']+participant.vars['Bonus1']+ participant.vars['Bonus2'], bonusy = participant.vars['Bonus1']+ participant.vars['Bonus2'] ) page_sequence = [Zapisz_zmienne, Grupa_wlasna, Grupa_obca, Ujawnienie_bonusy, Ankieta, Podsumowanie]