import math import random from otree.api import * doc = """ Your app description """ class Constants(BaseConstants): name_in_url = 'experiment' players_per_group = None num_rounds = 1 ABekl = 0.90 ARest = 0.10 ABuch = 0.50 BBekl = 0.10 BRest = 0.50 BBuch = 0.90 CBekl = 0.50 CRest = 0.80 CBuch = 0.20 DBekl = 0.40 DRest = 0.40 DBuch = 0.50 EBekl = 0.60 ERest = 0.60 EBuch = 0.30 BeDiv = 0.80 BeMin = 0.10 ReDiv = 0.70 ReMin = 0.10 BuDiv = 0.70 BuMin = 0.20 class Subsession(BaseSubsession): pass class Group(BaseGroup): pass class Player(BasePlayer): verlosung = models.StringField() verfahren = models.StringField() gutschein = models.StringField() gewinner = models.StringField() matrikelnummer = models.StringField() z1 = models.FloatField() z2 = models.FloatField() z3 = models.FloatField() z4 = models.FloatField() z5 = models.FloatField() # Abholcode abholcode = models.StringField() # Fragebogen start ###########Demographics########### gender = models.IntegerField( label="Bitte geben Sie Ihr Geschlecht an.", choices=[ [1, 'männlich'], [2, 'weiblich'], [3, 'divers'], [4, 'keine Angabe'], ] ) age = models.IntegerField(label="Bitte tragen Sie Ihr Alter ein (optional).", min=18, max=90, blank=True) studyfield = models.IntegerField( label="Bitte geben Sie Ihren Studiengang an.", choices=[ [1, '(Technische) Betriebswirtschaftslehre'], [2, 'Wirtschaftsingenieurwesen'], [3, 'Maschinenbau'], [4, 'Energie und Rohstoffe'], [5, 'Informatik/Wirtschaftsinformatik'], [6, 'Verfahrenstechnik/Chemieingenieurwesen'], [7, 'Chemie'], [8, 'Energietechnologien'], [9, 'Rohstoff-/Geowissenschafte'], [10, 'Materialwissenschaft und Werkstofftechnik'], [11, 'anderer Studiengang'], [12, 'kein Studium'], [13, 'keine Angabe'], ], ) studyprogress = models.IntegerField( label="In welchem Studienabschnitt befinden Sie sich?", choices=[ [1, 'Bachelor / Grundstudium'], [2, 'Master / Hauptstudium'], [3, 'Promotionsstudium'], [4, 'kein Studium'], [5, 'keine Angabe'], ], ) Citizenship = models.IntegerField( label="Welche Staatsbürgerschaft besitzen Sie?", choices=[ [1, 'afghanisch'], [2, 'ägyptisch'], [3, 'albanisch'], [4, 'algerisch'], [5, 'andorranisch'], [6, 'angolanisch'], [7, 'antiguanisch'], [8, 'äquatorialguineisch'], [9, 'argentinisch'], [10, 'armenisch'], [11, 'aserbaidschanisch'], [12, 'äthiopisch'], [13, 'australisch'], [14, 'bahamaisch'], [15, 'bahrainisch'], [16, 'bangladeschisch'], [17, 'barbadisch'], [18, 'belgisch'], [19, 'belizisch'], [20, 'beninisch'], [21, 'bhutanisch'], [22, 'bolivianisch'], [23, 'bosnisch-herzegowinisch'], [24, 'botsuanisch'], [25, 'brasilianisch'], [26, 'bruneiisch'], [27, 'bulgarisch'], [28, 'burkinisch'], [29, 'burundisch'], [30, 'chilenisch'], [31, 'chinesisch'], [32, 'neuseeländisch'], [33, 'costa-ricanisch'], [34, 'ivorisch'], [35, 'dänisch'], [36, 'deutsch'], [37, 'dominicanisch'], [38, 'dominikanisch'], [39, 'dschibutisch'], [40, 'ecuadorianisch'], [41, 'salvadorianisch'], [42, 'eritreisch'], [43, 'estnisch'], [44, 'fidschianisch'], [45, 'finnisch'], [46, 'französisch'], [47, 'gabunisch'], [48, 'gambisch'], [49, 'georgisch'], [50, 'ghanaisch'], [51, 'grenadisch'], [52, 'griechisch'], [53, 'guatemaltekisch'], [54, 'guineisch'], [55, 'guinea-bissauisch'], [56, 'guyanisch'], [57, 'haitianisch'], [58, 'honduranisch'], [59, 'indisch'], [60, 'indonesisch'], [61, 'irakisch'], [62, 'iranisch'], [63, 'irisch'], [64, 'isländisch'], [65, 'israelisch'], [66, 'italienisch'], [67, 'jamaikanisch'], [68, 'japanisch'], [69, 'jemenitisch'], [70, 'jordanisch'], [71, 'kambodschanisch'], [72, 'kamerunisch'], [73, 'kanadisch'], [74, 'kap-verdisch'], [75, 'kasachisch'], [76, 'katarisch'], [77, 'kenianisch'], [78, 'kirgisisch'], [79, 'kiribatisch'], [80, 'kolumbianisch'], [81, 'komorisch'], [82, 'kongolesisch'], [83, 'der Demokratischen Republik Kongo'], [84, 'der Demokratischen Volksrepublik Korea'], [85, 'der Republik Korea'], [86, 'kosovarisch'], [87, 'kroatisch'], [88, 'kubanisch'], [89, 'kuwaitisch'], [90, 'laotisch'], [91, 'lesothisch'], [92, 'lettisch'], [93, 'libanesisch'], [94, 'liberianisch'], [95, 'libysch'], [96, 'liechtensteinisch'], [97, 'litauisch'], [98, 'luxemburgisch'], [99, 'madagassisch'], [100, 'malawisch'], [101, 'malaysisch'], [102, 'maledivisch'], [103, 'malisch'], [104, 'maltesisch'], [105, 'marokkanisch'], [106, 'marshallisch'], [107, 'mauretanisch'], [108, 'mauritisch'], [109, 'mazedonisch'], [110, 'mexikanisch'], [111, 'mikronesisch'], [112, 'moldauisch'], [113, 'monegassisch'], [114, 'mongolisch'], [115, 'montenegrinisch'], [116, 'mosambikanisch'], [117, 'myanmarisch'], [118, 'namibisch'], [119, 'nauruisch'], [120, 'nepalesisch'], [121, 'neuseeländisch'], [122, 'nicaraguanisch'], [123, 'niederländisch'], [124, 'nigrisch'], [125, 'nigerianisch'], [126, 'neuseeländisch'], [127, 'norwegisch'], [128, 'omanisch'], [129, 'österreichisch'], [130, 'pakistanisch'], [131, 'palauisch'], [132, 'panamaisch'], [133, 'papua-neuguineisch'], [134, 'paraguayisch'], [135, 'peruanisch'], [136, 'philippinisch'], [137, 'polnisch'], [138, 'portugiesisch'], [139, 'ruandisch'], [140, 'rumänisch'], [141, 'russisch'], [142, 'salomonisch'], [143, 'sambisch'], [144, 'samoanisch'], [145, 'san-marinesisch'], [146, 'são-toméisch'], [147, 'saudi-arabisch'], [148, 'schwedisch'], [149, 'schweizerisch'], [150, 'senegalesisch'], [151, 'serbisch'], [152, 'seychellisch'], [153, 'sierra-leonisch'], [154, 'simbabwisch'], [155, 'singapurisch'], [156, 'slowakisch'], [157, 'slowenisch'], [158, 'somalisch'], [159, 'spanisch'], [160, 'sri-lankisch'], [161, 'von St. Kitts und Nevis'], [162, 'lucianisch'], [163, 'vincentisch'], [164, 'südafrikanisch'], [165, 'sudanesisch'], [166, 'südsudanesisch'], [167, 'surinamisch'], [168, 'swasiländisch'], [169, 'syrisch'], [170, 'tadschikisch'], [171, 'tansanisch'], [172, 'thailändisch'], [173, 'von Timor-Leste'], [174, 'togoisch'], [175, 'tongaisch'], [176, 'von Trinidad und Tobago'], [177, 'tschadisch'], [178, 'tschechisch'], [179, 'tunesisch'], [180, 'türkisch'], [181, 'turkmenisch'], [182, 'tuvaluisch'], [183, 'ugandisch'], [184, 'ukrainisch'], [185, 'ungarisch'], [186, 'uruguayisch'], [187, 'usbekisch'], [188, 'vanuatuisch'], [189, 'vatikanisch'], [190, 'venezolanisch'], [191, 'der Vereinigten Arabischen Emirate'], [192, 'amerikanisch'], [193, 'britisch'], [194, 'vietnamesisch'], [195, 'weißrussisch'], [196, 'zentralafrikanisch'], [197, 'zyprisch'], [198, 'keine Angabe'], ], initial=36, ) Entscheidung = models.IntegerField( label="Haben Sie bereits die Vorlesung 'Entscheidungstheorie' gehört?", choices=[ [1, 'ja'], [2, 'nein'], [3, 'keine Angabe'], ], ) # DecProcess = models.StringField( # label="Bitte beschreiben Sie möglichst genau Ihren Entscheidungsprozess bei der Auswahl einer Alternative", # ) # NameGoals1 = models.IntegerField( # label="Wählen Sie das Zielkriterium aus, welches Ihnen bei der Auswahl einer Alternative am wichtigsten war.", # choices=[ # [1,'Kosten'], # [2,'Wartezeit'], # ] # ) # NameGoals2 = models.StringField( # label="Bitte nennen Sie möglichst das Zielkriterium, welches bei der Entscheidung bzgl. einer Alternative wichtig war und erläutern Ihre Entscheidung kurz:", # ) Advice = models.LongStringField( label="Haben Sie Hinweise oder Anregungen, die Sie gerne noch zum Experiment machen möchten?", blank=True, ) lab_exp = models.IntegerField( choices=[[1, 'ja'], [2, 'nein'], [3, 'keine Angabe']], label="Haben Sie bisher schonmal an einem Laborexperiment teilgenommen?", widget=widgets.RadioSelect, ) # Fragebogen ende # Smart smart_verstaendlich = models.IntegerField( choices=[ [5, 'stimme voll und ganz zu'], [4, 'stimme zu'], [3, 'stimme weder zu noch lehne ich ab'], [2, 'stimme nicht zu'], [1, 'stimme überhaupt nicht zu'], ], widget=widgets.RadioSelect ) smart_vertrauen = models.IntegerField( choices=[ [5, 'stimme voll und ganz zu'], [4, 'stimme zu'], [3, 'stimme weder zu noch lehne ich ab'], [2, 'stimme nicht zu'], [1, 'stimme überhaupt nicht zu'], ], widget=widgets.RadioSelect ) smart_nwa_zufrieden = models.IntegerField( choices=[ [5, 'stimme voll und ganz zu'], [4, 'stimme zu'], [3, 'stimme weder zu noch lehne ich ab'], [2, 'stimme nicht zu'], [1, 'stimme überhaupt nicht zu'], ], widget=widgets.RadioSelect ) smart_top_zufrieden = models.IntegerField( choices=[ [5, 'stimme voll und ganz zu'], [4, 'stimme zu'], [3, 'stimme weder zu noch lehne ich ab'], [2, 'stimme nicht zu'], [1, 'stimme überhaupt nicht zu'], ], widget=widgets.RadioSelect ) smart_bekleidung = models.IntegerField(min=0, max=100) smart_restaurant = models.IntegerField(min=0, max=100) smart_buch = models.IntegerField(min=0, max=100) smart_max = models.StringField() smart_t_max = models.StringField() # AHP ahp_verstaendlich = models.IntegerField( choices=[ [5, 'stimme voll und ganz zu'], [4, 'stimme zu'], [3, 'stimme weder zu noch lehne ich ab'], [2, 'stimme nicht zu'], [1, 'stimme überhaupt nicht zu'], ], widget=widgets.RadioSelect ) ahp_vertrauen = models.IntegerField( choices=[ [5, 'stimme voll und ganz zu'], [4, 'stimme zu'], [3, 'stimme weder zu noch lehne ich ab'], [2, 'stimme nicht zu'], [1, 'stimme überhaupt nicht zu'], ], widget=widgets.RadioSelect ) ahp_top_zufrieden = models.IntegerField( choices=[ [5, 'stimme voll und ganz zu'], [4, 'stimme zu'], [3, 'stimme weder zu noch lehne ich ab'], [2, 'stimme nicht zu'], [1, 'stimme überhaupt nicht zu'], ], widget=widgets.RadioSelect ) ahp_nwa_zufrieden = models.IntegerField( choices=[ [5, 'stimme voll und ganz zu'], [4, 'stimme zu'], [3, 'stimme weder zu noch lehne ich ab'], [2, 'stimme nicht zu'], [1, 'stimme überhaupt nicht zu'], ], widget=widgets.RadioSelect ) Vergleiche_Bekleidung_Restaurant = models.IntegerField(min=1, max=9) Vergleiche_Restaurant_Bekleidung = models.IntegerField(min=10, max=90) Vergleiche_Bekleidung_Buch = models.IntegerField(min=1, max=9) Vergleiche_Buch_Bekleidung = models.IntegerField(min=10, max=90) Vergleiche_Restaurant_Buch = models.IntegerField(min=1, max=9) Vergleiche_Buch_Restaurant = models.IntegerField(min=10, max=90) ahp_max = models.StringField() ahp_t_max = models.StringField() AHP_Auswahl1 = models.IntegerField( choices=[ [1, 'Der Gutschein für Bekleidung ist besser oder mindestens genauso gut wie der Restaurantgutschein'], [2, 'Der Restaurantgutschein ist besser oder mindestens genauso gut wie der Gutschein für Bekleidung'], ], widget=widgets.RadioSelect ) AHP_Auswahl2 = models.IntegerField( choices=[ [1, 'Der Gutschein für Bekleidung ist besser oder mindestens genauso gut wie der Büchergutschein'], [2, 'Der Büchergutschein ist besser oder mindestens genauso gut wie der Gutschein für Bekleidung'], ], widget=widgets.RadioSelect ) AHP_Auswahl3 = models.IntegerField(blank=True, choices=[ [1, 'Der Restaurantgutschein ist besser als der Büchergutschein'], [2, 'Der Büchergutschein ist besser als der Restaurantgutschein'], ], widget=widgets.RadioSelect ) # Paarvergleich paar_verstaendlich = models.IntegerField( choices=[ [5, 'stimme voll und ganz zu'], [4, 'stimme zu'], [3, 'stimme weder zu noch lehne ich ab'], [2, 'stimme nicht zu'], [1, 'stimme überhaupt nicht zu'], ], widget=widgets.RadioSelect ) paar_vertrauen = models.IntegerField( choices=[ [5, 'stimme voll und ganz zu'], [4, 'stimme zu'], [3, 'stimme weder zu noch lehne ich ab'], [2, 'stimme nicht zu'], [1, 'stimme überhaupt nicht zu'], ], widget=widgets.RadioSelect ) paar_schwierig = models.IntegerField( choices=[ [5, 'stimme voll und ganz zu'], [4, 'stimme zu'], [3, 'stimme weder zu noch lehne ich ab'], [2, 'stimme nicht zu'], [1, 'stimme überhaupt nicht zu'], ], widget=widgets.RadioSelect ) paar_zufrieden = models.IntegerField( choices=[ [5, 'stimme voll und ganz zu'], [4, 'stimme zu'], [3, 'stimme weder zu noch lehne ich ab'], [2, 'stimme nicht zu'], [1, 'stimme überhaupt nicht zu'], ], widget=widgets.RadioSelect ) paar_max = models.StringField(blank=True) Auswahl_Hilfe = models.IntegerField( choices=[ [1, 'Hilfe an'], [0, 'Hilfe aus'], ], widget=widgets.RadioSelectHorizontal, initial=1, blank=True ) widget = widgets.RadioSelectHorizontal paar_A_B = models.IntegerField( choices=[ [1, 'A ist besser oder gleich B '], [0, 'B ist besser oder gleich A'], ], widget=widgets.RadioSelectHorizontal, initial=-1 ) paar_A_C = models.IntegerField( choices=[ [1, 'A ist besser oder gleich C '], [0, 'C ist besser oder gleich A'], ], widget=widgets.RadioSelectHorizontal, initial=-1 ) paar_A_D = models.IntegerField( choices=[ [1, 'A ist besser oder gleich D '], [0, ' D ist besser oder gleich A'], ], widget=widgets.RadioSelectHorizontal ) paar_A_E = models.IntegerField( choices=[ [1, 'A ist besser oder gleich E '], [0, 'E ist besser oder gleich A'], ], widget=widgets.RadioSelectHorizontal, initial=-1 ) paar_B_C = models.IntegerField( choices=[ [1, 'B ist besser oder gleich C '], [0, 'C ist besser oder gleich B'], ], widget=widgets.RadioSelectHorizontal ) paar_B_D = models.IntegerField( choices=[ [1, 'B ist besser oder gleich D '], [0, 'D ist besser oder gleich B'], ], widget=widgets.RadioSelectHorizontal, initial=-1 ) paar_B_E = models.IntegerField( choices=[ [1, 'B ist besser oder gleich E '], [0, 'E ist besser oder gleich B'], ], widget=widgets.RadioSelectHorizontal ) paar_C_D = models.IntegerField( choices=[ [1, 'C ist besser oder gleich D '], [0, 'D ist besser oder gleich C'], ], widget=widgets.RadioSelectHorizontal ) paar_C_E = models.IntegerField( choices=[ [1, 'C ist besser oder gleich E '], [0, 'E ist besser oder gleich C'], ], widget=widgets.RadioSelectHorizontal ) paar_D_E = models.IntegerField( choices=[ [1, 'D ist besser oder gleich E '], [0, 'E ist besser oder gleich D'], ], widget=widgets.RadioSelectHorizontal ) # Swing swing_verstaendlich = models.IntegerField( choices=[ [5, 'stimme voll und ganz zu'], [4, 'stimme zu'], [3, 'stimme weder zu noch lehne ich ab'], [2, 'stimme nicht zu'], [1, 'stimme überhaupt nicht zu'], ], widget=widgets.RadioSelect ) swing_vertrauen = models.IntegerField( choices=[ [5, 'stimme voll und ganz zu'], [4, 'stimme zu'], [3, 'stimme weder zu noch lehne ich ab'], [2, 'stimme nicht zu'], [1, 'stimme überhaupt nicht zu'], ], widget=widgets.RadioSelect ) swing_top_zufrieden = models.IntegerField( choices=[ [5, 'stimme voll und ganz zu'], [4, 'stimme zu'], [3, 'stimme weder zu noch lehne ich ab'], [2, 'stimme nicht zu'], [1, 'stimme überhaupt nicht zu'], ], widget=widgets.RadioSelect ) swing_nwa_zufrieden = models.IntegerField( choices=[ [5, 'stimme voll und ganz zu'], [4, 'stimme zu'], [3, 'stimme weder zu noch lehne ich ab'], [2, 'stimme nicht zu'], [1, 'stimme überhaupt nicht zu'], ], widget=widgets.RadioSelect ) Swing_Bekleidung = models.IntegerField(min=0, max=100) Swing_Restaurant = models.IntegerField(min=0, max=100) Swing_Buch = models.IntegerField(min=0, max=100) swing_max = models.StringField() swing_t_max = models.StringField() swing_maxi = models.IntegerField( choices=[ [1, 'Swing 1'], [2, 'Swing 2'], [3, 'Swing 3'], ], widget=widgets.RadioSelectHorizontal ) # Trade Off trade_off_verstaendlich = models.IntegerField( choices=[ [5, 'stimme voll und ganz zu'], [4, 'stimme zu'], [3, 'stimme weder zu noch lehne ich ab'], [2, 'stimme nicht zu'], [1, 'stimme überhaupt nicht zu'], ], widget=widgets.RadioSelect ) trade_off_vertrauen = models.IntegerField( choices=[ [5, 'stimme voll und ganz zu'], [4, 'stimme zu'], [3, 'stimme weder zu noch lehne ich ab'], [2, 'stimme nicht zu'], [1, 'stimme überhaupt nicht zu'], ], widget=widgets.RadioSelect ) trade_off_top_zufrieden = models.IntegerField( choices=[ [5, 'stimme voll und ganz zu'], [4, 'stimme zu'], [3, 'stimme weder zu noch lehne ich ab'], [2, 'stimme nicht zu'], [1, 'stimme überhaupt nicht zu'], ], widget=widgets.RadioSelect ) trade_off_nwa_zufrieden = models.IntegerField( choices=[ [5, 'stimme voll und ganz zu'], [4, 'stimme zu'], [3, 'stimme weder zu noch lehne ich ab'], [2, 'stimme nicht zu'], [1, 'stimme überhaupt nicht zu'], ], widget=widgets.RadioSelect ) TO_Auswahl1 = models.IntegerField( choices=[ [1, 'T1 ist besser als T2'], [2, 'T2 ist besser als T1'], [3, 'T1 und T2 sind gleich gut'], ], widget=widgets.RadioSelectHorizontal ) TOWert1 = models.FloatField(min=10.5, max=90) TO_Auswahl2 = models.IntegerField( choices=[ [1, 'T3 ist besser als T4'], [2, 'T4 ist besser als T3'], [3, 'T3 und T4 sind gleich gut'], ], widget=widgets.RadioSelectHorizontal ) TOWert2 = models.FloatField(min=10.5, max=90) to_max = models.StringField() to_t_max = models.StringField() # Fragebogen page class Demographics(Page): def is_displayed(player): return player.round_number == Constants.num_rounds form_model = 'player' form_fields = ['gender', 'age', 'studyfield', 'studyprogress', 'Citizenship', 'Entscheidung', 'lab_exp', 'Advice'] class Information1(Page): def vars_for_template(player): player.abholcode = str(player.participant.code) + str(random.randint(1, 9999)).zfill(4) return dict(abholcode=player.abholcode) class Information2(Page): def vars_for_template(player): return dict(abholcode=player.abholcode) class SmartEingabe(Page): form_model = 'player' form_fields = ['smart_bekleidung', 'smart_restaurant', 'smart_buch'] @staticmethod def error_message(player, values): print('values is', values) if values['smart_bekleidung'] + values['smart_restaurant'] + values['smart_buch'] == 0: return 'Die Summe der Punkte muss größer 0 sein.' class SmartResults(Page): form_model = 'player' form_fields = ['smart_vertrauen', 'smart_verstaendlich', 'smart_nwa_zufrieden', 'smart_top_zufrieden'] @staticmethod def vars_for_template(player): summe = player.smart_bekleidung + player.smart_restaurant + player.smart_buch smartgb = player.smart_bekleidung / summe smartgr = player.smart_restaurant / summe smartgbu = player.smart_buch / summe smart_bew_a = smartgb * (Constants.ABekl - Constants.BeMin) / Constants.BeDiv + \ smartgr * (Constants.ARest - Constants.ReMin) / Constants.ReDiv + \ smartgbu * (Constants.ABuch - Constants.BuMin) / Constants.BuDiv smart_bew_b = smartgb * (Constants.BBekl - Constants.BeMin) / Constants.BeDiv + \ smartgr * (Constants.BRest - Constants.ReMin) / Constants.ReDiv + \ smartgbu * (Constants.BBuch - Constants.BuMin) / Constants.BuDiv smart_bew_c = smartgb * (Constants.CBekl - Constants.BeMin) / Constants.BeDiv + \ smartgr * (Constants.CRest - Constants.ReMin) / Constants.ReDiv + \ smartgbu * (Constants.CBuch - Constants.BuMin) / Constants.BuDiv smart_bew_d = smartgb * (Constants.DBekl - Constants.BeMin) / Constants.BeDiv + \ smartgr * (Constants.DRest - Constants.ReMin) / Constants.ReDiv + \ smartgbu * (Constants.DBuch - Constants.BuMin) / Constants.BuDiv smart_bew_e = smartgb * (Constants.EBekl - Constants.BeMin) / Constants.BeDiv + \ smartgr * (Constants.ERest - Constants.ReMin) / Constants.ReDiv + \ smartgbu * (Constants.EBuch - Constants.BuMin) / Constants.BuDiv smart_template = ['A ( Bekleidung 90%, Restaurant 10%, Bücher 50% )', 'B ( Bekleidung 10%, Restaurant 50%, Bücher 90% )', 'C ( Bekleidung 50%, Restaurant 80%, Bücher 20% )', 'D ( Bekleidung 40%, Restaurant 40%, Bücher 50% )', 'E ( Bekleidung 60%, Restaurant 60%, Bücher 30% )'] smart_t_template = ['A ( Bekleidung 90%, Restaurant 10%, Bücher 50% )', 'B ( Bekleidung 10%, Restaurant 50%, Bücher 90% )', 'C ( Bekleidung 50%, Restaurant 80%, Bücher 20% )', 'D ( Bekleidung 40%, Restaurant 40%, Bücher 50% )', 'E ( Bekleidung 60%, Restaurant 60%, Bücher 30% )'] smart_nwa = [smart_bew_a, smart_bew_b, smart_bew_c, smart_bew_d, smart_bew_e] smart_nwa_rei = ['A', 'B', 'C', 'D', 'E'] for i in [0, 1, 2, 3, 4]: for j in [0, 1, 2, 3, 4]: if smart_nwa[i] > smart_nwa[j]: smart_nwa_rei[i], smart_nwa_rei[j] = smart_nwa_rei[j], smart_nwa_rei[i] smart_nwa[i], smart_nwa[j] = smart_nwa[j], smart_nwa[i] smart_template[i], smart_template[j] = smart_template[j], smart_template[i] player.smart_max = smart_nwa_rei[0] wurzelBe = math.sqrt(0.9 ** 2 + 0.1 ** 2 + 0.5 ** 2 + 0.4 ** 2 + 0.6 ** 2) wurzelRe = math.sqrt(0.1 ** 2 + 0.5 ** 2 + 0.8 ** 2 + 0.4 ** 2 + 0.6 ** 2) wurzelBu = math.sqrt(0.5 ** 2 + 0.9 ** 2 + 0.2 ** 2 + 0.5 ** 2 + 0.3 ** 2) smart_best_be = 0.9 * smartgb / wurzelBe smart_schl_be = 0.1 * smartgb / wurzelBe smart_best_re = 0.8 * smartgr / wurzelRe smart_schl_re = 0.1 * smartgr / wurzelRe smart_best_bu = 0.9 * smartgbu / wurzelBu smart_schl_bu = 0.2 * smartgbu / wurzelBu smarta_abst_best = math.sqrt( (smartgb * Constants.ABekl / wurzelBe - smart_best_be) ** 2 + (smartgr * Constants.ARest / wurzelRe - smart_best_re) ** 2 + (smartgbu * Constants.ABuch / wurzelBu - smart_best_bu) ** 2) smarta_abst_schl = math.sqrt( (smartgb * Constants.ABekl / wurzelBe - smart_schl_be) ** 2 + (smartgr * Constants.ARest / wurzelRe - smart_schl_re) ** 2 + (smartgbu * Constants.ABuch / wurzelBu - smart_schl_bu) ** 2) smartb_abst_best = math.sqrt( (smartgb * Constants.BBekl / wurzelBe - smart_best_be) ** 2 + (smartgr * Constants.BRest / wurzelRe - smart_best_re) ** 2 + (smartgbu * Constants.BBuch / wurzelBu - smart_best_bu) ** 2) smartb_abst_schl = math.sqrt( (smartgb * Constants.BBekl / wurzelBe - smart_schl_be) ** 2 + (smartgr * Constants.BRest / wurzelRe - smart_schl_re) ** 2 + (smartgbu * Constants.BBuch / wurzelBu - smart_schl_bu) ** 2) smartc_abst_best = math.sqrt( (smartgb * Constants.CBekl / wurzelBe - smart_best_be) ** 2 + (smartgr * Constants.CRest / wurzelRe - smart_best_re) ** 2 + (smartgbu * Constants.CBuch / wurzelBu - smart_best_bu) ** 2) smartc_abst_schl = math.sqrt( (smartgb * Constants.CBekl / wurzelBe - smart_schl_be) ** 2 + (smartgr * Constants.CRest / wurzelRe - smart_schl_re) ** 2 + (smartgbu * Constants.CBuch / wurzelBu - smart_schl_bu) ** 2) smartd_abst_best = math.sqrt( (smartgb * Constants.DBekl / wurzelBe - smart_best_be) ** 2 + (smartgr * Constants.DRest / wurzelRe - smart_best_re) ** 2 + (smartgbu * Constants.DBuch / wurzelBu - smart_best_bu) ** 2) smartd_abst_schl = math.sqrt( (smartgb * Constants.DBekl / wurzelBe - smart_schl_be) ** 2 + (smartgr * Constants.DRest / wurzelRe - smart_schl_re) ** 2 + (smartgbu * Constants.DBuch / wurzelBu - smart_schl_bu) ** 2) smarte_abst_best = math.sqrt( (smartgb * Constants.EBekl / wurzelBe - smart_best_be) ** 2 + (smartgr * Constants.ERest / wurzelRe - smart_best_re) ** 2 + (smartgbu * Constants.EBuch / wurzelBu - smart_best_bu) ** 2) smarte_abst_schl = math.sqrt( (smartgb * Constants.EBekl / wurzelBe - smart_schl_be) ** 2 + (smartgr * Constants.ERest / wurzelRe - smart_schl_re) ** 2 + (smartgbu * Constants.EBuch / wurzelBu - smart_schl_bu) ** 2) smclosa = smarta_abst_schl / (smarta_abst_schl + smarta_abst_best) smclosb = smartb_abst_schl / (smartb_abst_schl + smartb_abst_best) smclosc = smartc_abst_schl / (smartc_abst_schl + smartc_abst_best) smclosd = smartd_abst_schl / (smartd_abst_schl + smartd_abst_best) smclose = smarte_abst_schl / (smarte_abst_schl + smarte_abst_best) smart_top = [smclosa, smclosb, smclosc, smclosd, smclose] smart_top_rei = ['A', 'B', 'C', 'D', 'E'] for i in [0, 1, 2, 3, 4]: for j in [0, 1, 2, 3, 4]: if smart_top[i] > smart_top[j]: smart_top_rei[i], smart_top_rei[j] = smart_top_rei[j], smart_top_rei[i] smart_top[i], smart_top[j] = smart_top[j], smart_top[i] smart_t_template[i], smart_t_template[j] = smart_t_template[j], smart_t_template[i] player.smart_t_max = smart_top_rei[0] return dict(smart_template0=smart_template[0], smart_template1=smart_template[1], smart_template2=smart_template[2], smart_template3=smart_template[3], smart_template4=smart_template[4], smart_t_template0=smart_t_template[0], smart_t_template1=smart_t_template[1], smart_t_template2=smart_t_template[2], smart_t_template3=smart_t_template[3], smart_t_template4=smart_t_template[4] ) class SwingEingabe(Page): form_model = 'player' form_fields = ['Swing_Bekleidung', 'Swing_Restaurant', 'Swing_Buch', 'swing_maxi'] @staticmethod def error_message(player, values): print('values is', values) if values['swing_maxi'] == 1 and values['Swing_Bekleidung'] != 100: return 'Bekleidung muss mit 100 Punkten bewerten werden.' if values['swing_maxi'] == 2 and values['Swing_Restaurant'] != 100: return 'Restaurant muss mit 100 Punkten bewerten werden.' if values['swing_maxi'] == 3 and values['Swing_Buch'] != 100: return 'Bücher muss mit 100 Punkten bewerten werden.' class SwingResults(Page): form_model = 'player' form_fields = ['swing_vertrauen', 'swing_verstaendlich', 'swing_nwa_zufrieden', 'swing_top_zufrieden'] @staticmethod def vars_for_template(player): summe = player.Swing_Bekleidung + player.Swing_Restaurant + player.Swing_Buch swinggb = player.Swing_Bekleidung / summe swinggr = player.Swing_Restaurant / summe swinggbu = player.Swing_Buch / summe swing_bew_a = swinggb * (Constants.ABekl - Constants.BeMin) / Constants.BeDiv + \ swinggr * (Constants.ARest - Constants.ReMin) / Constants.ReDiv + \ swinggbu * (Constants.ABuch - Constants.BuMin) / Constants.BuDiv swing_bew_b = swinggb * (Constants.BBekl - Constants.BeMin) / Constants.BeDiv + \ swinggr * (Constants.BRest - Constants.ReMin) / Constants.ReDiv + \ swinggbu * (Constants.BBuch - Constants.BuMin) / Constants.BuDiv swing_bew_c = swinggb * (Constants.CBekl - Constants.BeMin) / Constants.BeDiv + \ swinggr * (Constants.CRest - Constants.ReMin) / Constants.ReDiv + \ swinggbu * (Constants.CBuch - Constants.BuMin) / Constants.BuDiv swing_bew_d = swinggb * (Constants.DBekl - Constants.BeMin) / Constants.BeDiv + \ swinggr * (Constants.DRest - Constants.ReMin) / Constants.ReDiv + \ swinggbu * (Constants.DBuch - Constants.BuMin) / Constants.BuDiv swing_bew_e = swinggb * (Constants.EBekl - Constants.BeMin) / Constants.BeDiv + \ swinggr * (Constants.ERest - Constants.ReMin) / Constants.ReDiv + \ swinggbu * (Constants.EBuch - Constants.BuMin) / Constants.BuDiv player.swing_max = 'E' swing_template = ['A ( Bekleidung 90%, Restaurant 10%, Bücher 50% )', 'B ( Bekleidung 10%, Restaurant 50%, Bücher 90% )', 'C ( Bekleidung 50%, Restaurant 80%, Bücher 20% )', 'D ( Bekleidung 40%, Restaurant 40%, Bücher 50% )', 'E ( Bekleidung 60%, Restaurant 60%, Bücher 30% )'] swing_t_template = ['A ( Bekleidung 90%, Restaurant 10%, Bücher 50% )', 'B ( Bekleidung 10%, Restaurant 50%, Bücher 90% )', 'C ( Bekleidung 50%, Restaurant 80%, Bücher 20% )', 'D ( Bekleidung 40%, Restaurant 40%, Bücher 50% )', 'E ( Bekleidung 60%, Restaurant 60%, Bücher 30% )'] swing_nwa = [swing_bew_a, swing_bew_b, swing_bew_c, swing_bew_d, swing_bew_e] swing_nwa_rei = ['A', 'B', 'C', 'D', 'E'] for i in [0, 1, 2, 3, 4]: for j in [0, 1, 2, 3, 4]: if swing_nwa[i] > swing_nwa[j]: swing_nwa_rei[i], swing_nwa_rei[j] = swing_nwa_rei[j], swing_nwa_rei[i] swing_nwa[i], swing_nwa[j] = swing_nwa[j], swing_nwa[i] swing_template[i], swing_template[j] = swing_template[j], swing_template[i] player.swing_max = swing_nwa_rei[0] wurzelBe = math.sqrt(0.9 ** 2 + 0.1 ** 2 + 0.5 ** 2 + 0.4 ** 2 + 0.6 ** 2) wurzelRe = math.sqrt(0.1 ** 2 + 0.5 ** 2 + 0.8 ** 2 + 0.4 ** 2 + 0.6 ** 2) wurzelBu = math.sqrt(0.5 ** 2 + 0.9 ** 2 + 0.2 ** 2 + 0.5 ** 2 + 0.3 ** 2) swing_best_be = 0.9 * swinggb / wurzelBe swing_schl_be = 0.1 * swinggb / wurzelBe swing_best_re = 0.8 * swinggr / wurzelRe swing_schl_re = 0.1 * swinggr / wurzelRe swing_best_bu = 0.9 * swinggbu / wurzelBu swing_schl_bu = 0.2 * swinggbu / wurzelBu swinga_abst_best = math.sqrt((swinggb * Constants.ABekl / wurzelBe - swing_best_be) ** 2 + (swinggr * Constants.ARest / wurzelRe - swing_best_re) ** 2 + (swinggbu * Constants.ABuch / wurzelBu - swing_best_bu) ** 2) swinga_abst_schl = math.sqrt((swinggb * Constants.ABekl / wurzelBe - swing_schl_be) ** 2 + (swinggr * Constants.ARest / wurzelRe - swing_schl_re) ** 2 + (swinggbu * Constants.ABuch / wurzelBu - swing_schl_bu) ** 2) swingb_abst_best = math.sqrt((swinggb * Constants.BBekl / wurzelBe - swing_best_be) ** 2 + (swinggr * Constants.BRest / wurzelRe - swing_best_re) ** 2 + (swinggbu * Constants.BBuch / wurzelBu - swing_best_bu) ** 2) swingb_abst_schl = math.sqrt((swinggb * Constants.BBekl / wurzelBe - swing_schl_be) ** 2 + (swinggr * Constants.BRest / wurzelRe - swing_schl_re) ** 2 + (swinggbu * Constants.BBuch / wurzelBu - swing_schl_bu) ** 2) swingc_abst_best = math.sqrt((swinggb * Constants.CBekl / wurzelBe - swing_best_be) ** 2 + (swinggr * Constants.CRest / wurzelRe - swing_best_re) ** 2 + (swinggbu * Constants.CBuch / wurzelBu - swing_best_bu) ** 2) swingc_abst_schl = math.sqrt((swinggb * Constants.CBekl / wurzelBe - swing_schl_be) ** 2 + (swinggr * Constants.CRest / wurzelRe - swing_schl_re) ** 2 + (swinggbu * Constants.CBuch / wurzelBu - swing_schl_bu) ** 2) swingd_abst_best = math.sqrt((swinggb * Constants.DBekl / wurzelBe - swing_best_be) ** 2 + (swinggr * Constants.DRest / wurzelRe - swing_best_re) ** 2 + (swinggbu * Constants.DBuch / wurzelBu - swing_best_bu) ** 2) swingd_abst_schl = math.sqrt((swinggb * Constants.DBekl / wurzelBe - swing_schl_be) ** 2 + (swinggr * Constants.DRest / wurzelRe - swing_schl_re) ** 2 + (swinggbu * Constants.DBuch / wurzelBu - swing_schl_bu) ** 2) swinge_abst_best = math.sqrt((swinggb * Constants.EBekl / wurzelBe - swing_best_be) ** 2 + (swinggr * Constants.ERest / wurzelRe - swing_best_re) ** 2 + (swinggbu * Constants.EBuch / wurzelBu - swing_best_bu) ** 2) swinge_abst_schl = math.sqrt((swinggb * Constants.EBekl / wurzelBe - swing_schl_be) ** 2 + (swinggr * Constants.ERest / wurzelRe - swing_schl_re) ** 2 + (swinggbu * Constants.EBuch / wurzelBu - swing_schl_bu) ** 2) swclosa = swinga_abst_schl / (swinga_abst_schl + swinga_abst_best) swclosb = swingb_abst_schl / (swingb_abst_schl + swingb_abst_best) swclosc = swingc_abst_schl / (swingc_abst_schl + swingc_abst_best) swclosd = swingd_abst_schl / (swingd_abst_schl + swingd_abst_best) swclose = swinge_abst_schl / (swinge_abst_schl + swinge_abst_best) swing_top = [swclosa, swclosb, swclosc, swclosd, swclose] swing_top_rei = ['A', 'B', 'C', 'D', 'E'] for i in [0, 1, 2, 3, 4]: for j in [0, 1, 2, 3, 4]: if swing_top[i] > swing_top[j]: swing_top_rei[i], swing_top_rei[j] = swing_top_rei[j], swing_top_rei[i] swing_top[i], swing_top[j] = swing_top[j], swing_top[i] swing_t_template[i], swing_t_template[j] = swing_t_template[j], swing_t_template[i] player.swing_t_max = swing_top_rei[0] return dict(swing_template0=swing_template[0], swing_template1=swing_template[1], swing_template2=swing_template[2], swing_template3=swing_template[3], swing_template4=swing_template[4], swing_t_template0=swing_t_template[0], swing_t_template1=swing_t_template[1], swing_t_template2=swing_t_template[2], swing_t_template3=swing_t_template[3], swing_t_template4=swing_t_template[4] ) class AHPEingabe1(Page): form_model = 'player' form_fields = ['Vergleiche_Bekleidung_Restaurant', 'AHP_Auswahl1'] class AHPEingabe2(Page): form_model = 'player' form_fields = ['Vergleiche_Bekleidung_Buch', 'AHP_Auswahl2'] class AHPEingabe3(Page): form_model = 'player' form_fields = ['Vergleiche_Restaurant_Buch', 'AHP_Auswahl3'] @staticmethod def vars_for_template(player): if player.AHP_Auswahl1 == 1: if player.AHP_Auswahl2 == 2: player.AHP_Auswahl3 = 2 if player.AHP_Auswahl2 == 1: player.AHP_Auswahl3 = 4 if player.AHP_Auswahl1 == 2: if player.AHP_Auswahl2 == 1: player.AHP_Auswahl3 = 1 if player.AHP_Auswahl2 == 2: player.AHP_Auswahl3 = 4 return dict(DritteAuswahl=player.AHP_Auswahl3 ) class AHPResults(Page): form_model = 'player' form_fields = ['ahp_vertrauen', 'ahp_verstaendlich', 'ahp_nwa_zufrieden', 'ahp_top_zufrieden'] @staticmethod def vars_for_template(player): a11 = 1 a21 = 1 a31 = 1 a32 = 1 if player.AHP_Auswahl1 == 1: a21 = 1 / player.Vergleiche_Bekleidung_Restaurant if player.AHP_Auswahl1 == 2: a21 = player.Vergleiche_Bekleidung_Restaurant if player.AHP_Auswahl2 == 1: a31 = 1 / player.Vergleiche_Bekleidung_Buch if player.AHP_Auswahl2 == 2: a31 = player.Vergleiche_Bekleidung_Buch a12 = 1 / a21 a22 = 1 if player.AHP_Auswahl3 == 1: a32 = 1 / player.Vergleiche_Restaurant_Buch if player.AHP_Auswahl3 == 2: a32 = player.Vergleiche_Restaurant_Buch a13 = 1 / a31 a23 = 1 / a32 a33 = 1 SpS1 = a11 + a21 + a31 SpS2 = a12 + a22 + a32 SpS3 = a13 + a23 + a33 b11 = a11 / SpS1 b21 = a21 / SpS1 b31 = a31 / SpS1 b12 = a12 / SpS2 b22 = a22 / SpS2 b32 = a32 / SpS2 b13 = a13 / SpS3 b23 = a23 / SpS3 b33 = a33 / SpS3 Zs1 = b11 + b12 + b13 Zs2 = b21 + b22 + b23 Zs3 = b31 + b32 + b33 GSumme = Zs1 + Zs2 + Zs3 ahpgb = Zs1 / GSumme ahpgr = Zs2 / GSumme ahpgbu = Zs3 / GSumme print(ahpgb, ahpgr, ahpgbu) ahp_bew_a = ahpgb * (Constants.ABekl - Constants.BeMin) / Constants.BeDiv + \ ahpgr * (Constants.ARest - Constants.ReMin) / Constants.ReDiv + \ ahpgbu * (Constants.ABuch - Constants.BuMin) / Constants.BuDiv ahp_bew_b = ahpgb * (Constants.BBekl - Constants.BeMin) / Constants.BeDiv + \ ahpgr * (Constants.BRest - Constants.ReMin) / Constants.ReDiv + \ ahpgbu * (Constants.BBuch - Constants.BuMin) / Constants.BuDiv ahp_bew_c = ahpgb * (Constants.CBekl - Constants.BeMin) / Constants.BeDiv + \ ahpgr * (Constants.CRest - Constants.ReMin) / Constants.ReDiv + \ ahpgbu * (Constants.CBuch - Constants.BuMin) / Constants.BuDiv ahp_bew_d = ahpgb * (Constants.DBekl - Constants.BeMin) / Constants.BeDiv + \ ahpgr * (Constants.DRest - Constants.ReMin) / Constants.ReDiv + \ ahpgbu * (Constants.DBuch - Constants.BuMin) / Constants.BuDiv ahp_bew_e = ahpgb * (Constants.EBekl - Constants.BeMin) / Constants.BeDiv + \ ahpgr * (Constants.ERest - Constants.ReMin) / Constants.ReDiv + \ ahpgbu * (Constants.EBuch - Constants.BuMin) / Constants.BuDiv ahp_template = ['A ( Bekleidung 90%, Restaurant 10%, Bücher 50% )', 'B ( Bekleidung 10%, Restaurant 50%, Bücher 90% )', 'C ( Bekleidung 50%, Restaurant 80%, Bücher 20% )', 'D ( Bekleidung 40%, Restaurant 40%, Bücher 50% )', 'E ( Bekleidung 60%, Restaurant 60%, Bücher 30% )'] ahp_t_template = ['A ( Bekleidung 90%, Restaurant 10%, Bücher 50% )', 'B ( Bekleidung 10%, Restaurant 50%, Bücher 90% )', 'C ( Bekleidung 50%, Restaurant 80%, Bücher 20% )', 'D ( Bekleidung 40%, Restaurant 40%, Bücher 50% )', 'E ( Bekleidung 60%, Restaurant 60%, Bücher 30% )'] ahp_nwa = [ahp_bew_a, ahp_bew_b, ahp_bew_c, ahp_bew_d, ahp_bew_e] ahp_nwa_rei = ['A', 'B', 'C', 'D', 'E'] for i in [0, 1, 2, 3, 4]: for j in [0, 1, 2, 3, 4]: if ahp_nwa[i] > ahp_nwa[j]: ahp_nwa_rei[i], ahp_nwa_rei[j] = ahp_nwa_rei[j], ahp_nwa_rei[i] ahp_nwa[i], ahp_nwa[j] = ahp_nwa[j], ahp_nwa[i] ahp_template[i], ahp_template[j] = ahp_template[j], ahp_template[i] player.ahp_max = ahp_nwa_rei[0] wurzelBe = math.sqrt(0.9 ** 2 + 0.1 ** 2 + 0.5 ** 2 + 0.4 ** 2 + 0.6 ** 2) wurzelRe = math.sqrt(0.1 ** 2 + 0.5 ** 2 + 0.8 ** 2 + 0.4 ** 2 + 0.6 ** 2) wurzelBu = math.sqrt(0.5 ** 2 + 0.9 ** 2 + 0.2 ** 2 + 0.5 ** 2 + 0.3 ** 2) ahp_best_be = 0.9 * ahpgb / wurzelBe ahp_schl_be = 0.1 * ahpgb / wurzelBe ahp_best_re = 0.8 * ahpgr / wurzelRe ahp_schl_re = 0.1 * ahpgr / wurzelRe ahp_best_bu = 0.9 * ahpgbu / wurzelBu ahp_schl_bu = 0.2 * ahpgbu / wurzelBu ahpa_abst_best = math.sqrt((ahpgb * Constants.ABekl / wurzelBe - ahp_best_be) ** 2 + (ahpgr * Constants.ARest / wurzelRe - ahp_best_re) ** 2 + (ahpgbu * Constants.ABuch / wurzelBu - ahp_best_bu) ** 2) ahpa_abst_schl = math.sqrt((ahpgb * Constants.ABekl / wurzelBe - ahp_schl_be) ** 2 + (ahpgr * Constants.ARest / wurzelRe - ahp_schl_re) ** 2 + (ahpgbu * Constants.ABuch / wurzelBu - ahp_schl_bu) ** 2) ahpb_abst_best = math.sqrt((ahpgb * Constants.BBekl / wurzelBe - ahp_best_be) ** 2 + (ahpgr * Constants.BRest / wurzelRe - ahp_best_re) ** 2 + (ahpgbu * Constants.BBuch / wurzelBu - ahp_best_bu) ** 2) ahpb_abst_schl = math.sqrt((ahpgb * Constants.BBekl / wurzelBe - ahp_schl_be) ** 2 + (ahpgr * Constants.BRest / wurzelRe - ahp_schl_re) ** 2 + (ahpgbu * Constants.BBuch / wurzelBu - ahp_schl_bu) ** 2) ahpc_abst_best = math.sqrt((ahpgb * Constants.CBekl / wurzelBe - ahp_best_be) ** 2 + (ahpgr * Constants.CRest / wurzelRe - ahp_best_re) ** 2 + (ahpgbu * Constants.CBuch / wurzelBu - ahp_best_bu) ** 2) ahpc_abst_schl = math.sqrt((ahpgb * Constants.CBekl / wurzelBe - ahp_schl_be) ** 2 + (ahpgr * Constants.CRest / wurzelRe - ahp_schl_re) ** 2 + (ahpgbu * Constants.CBuch / wurzelBu - ahp_schl_bu) ** 2) ahpd_abst_best = math.sqrt((ahpgb * Constants.DBekl / wurzelBe - ahp_best_be) ** 2 + (ahpgr * Constants.DRest / wurzelRe - ahp_best_re) ** 2 + (ahpgbu * Constants.DBuch / wurzelBu - ahp_best_bu) ** 2) ahpd_abst_schl = math.sqrt((ahpgb * Constants.DBekl / wurzelBe - ahp_schl_be) ** 2 + (ahpgr * Constants.DRest / wurzelRe - ahp_schl_re) ** 2 + (ahpgbu * Constants.DBuch / wurzelBu - ahp_schl_bu) ** 2) ahpe_abst_best = math.sqrt((ahpgb * Constants.EBekl / wurzelBe - ahp_best_be) ** 2 + (ahpgr * Constants.ERest / wurzelRe - ahp_best_re) ** 2 + (ahpgbu * Constants.EBuch / wurzelBu - ahp_best_bu) ** 2) ahpe_abst_schl = math.sqrt((ahpgb * Constants.EBekl / wurzelBe - ahp_schl_be) ** 2 + (ahpgr * Constants.ERest / wurzelRe - ahp_schl_re) ** 2 + (ahpgbu * Constants.EBuch / wurzelBu - ahp_schl_bu) ** 2) ahpclosa = ahpa_abst_schl / (ahpa_abst_schl + ahpa_abst_best) ahpclosb = ahpb_abst_schl / (ahpb_abst_schl + ahpb_abst_best) ahpclosc = ahpc_abst_schl / (ahpc_abst_schl + ahpc_abst_best) ahpclosd = ahpd_abst_schl / (ahpd_abst_schl + ahpd_abst_best) ahpclose = ahpe_abst_schl / (ahpe_abst_schl + ahpe_abst_best) ahp_top = [ahpclosa, ahpclosb, ahpclosc, ahpclosd, ahpclose] ahp_top_rei = ['A', 'B', 'C', 'D', 'E'] for i in [0, 1, 2, 3, 4]: for j in [0, 1, 2, 3, 4]: if ahp_top[i] > ahp_top[j]: ahp_top_rei[i], ahp_top_rei[j] = ahp_top_rei[j], ahp_top_rei[i] ahp_top[i], ahp_top[j] = ahp_top[j], ahp_top[i] ahp_t_template[i], ahp_t_template[j] = ahp_t_template[j], ahp_t_template[i] player.ahp_t_max = ahp_top_rei[0] return dict(ahp_template0=ahp_template[0], ahp_template1=ahp_template[1], ahp_template2=ahp_template[2], ahp_template3=ahp_template[3], ahp_template4=ahp_template[4], ahp_t_template0=ahp_t_template[0], ahp_t_template1=ahp_t_template[1], ahp_t_template2=ahp_t_template[2], ahp_t_template3=ahp_t_template[3], ahp_t_template4=ahp_t_template[4] ) class TradeOffEingabe1(Page): form_model = 'player' form_fields = ['TO_Auswahl1', 'TOWert1'] @staticmethod def error_message(player, values): print('values is', values) if values['TO_Auswahl1'] == 1 and values['TOWert1'] <= 15: return 'Der Wert im Feld muss größer als 15 sein.' if values['TO_Auswahl1'] == 2 and values['TOWert1'] >= 15: return 'Der Wert im Feld muss kleiner als 15 sein.' if values['TO_Auswahl1'] == 3 and values['TOWert1'] != 15: return 'Der Wert im Feld muss gleich 15 sein.' class TradeOffEingabe2(Page): form_model = 'player' form_fields = ['TO_Auswahl2', 'TOWert2'] @staticmethod def error_message(player, values): print('values is', values) if values['TO_Auswahl2'] == 1 and values['TOWert2'] <= 15: return 'Der Wert im Feld muss größer als 15 sein.' if values['TO_Auswahl2'] == 2 and values['TOWert2'] >= 15: return 'Der Wert im Feld muss kleiner als 15 sein.' if values['TO_Auswahl2'] == 3 and values['TOWert2'] != 15: return 'Der Wert im Feld muss gleich 15 sein.' class TradeOffResults(Page): form_model = 'player' form_fields = ['trade_off_vertrauen', 'trade_off_verstaendlich', 'trade_off_nwa_zufrieden', 'trade_off_top_zufrieden'] @staticmethod def vars_for_template(player): re = 9 / (player.TOWert1 - 10) * 70 / 80 bu = 9 / (player.TOWert2 - 10) * 70 / 80 print(re, bu) togb = 1 / (1 + re + bu) togr = togb * re togbu = togb * bu print(togb, togr, togbu) to_bew_a = togb * (Constants.ABekl - Constants.BeMin) / Constants.BeDiv + \ togr * (Constants.ARest - Constants.ReMin) / Constants.ReDiv + \ togbu * (Constants.ABuch - Constants.BuMin) / Constants.BuDiv to_bew_b = togb * (Constants.BBekl - Constants.BeMin) / Constants.BeDiv + \ togr * (Constants.BRest - Constants.ReMin) / Constants.ReDiv + \ togbu * (Constants.BBuch - Constants.BuMin) / Constants.BuDiv to_bew_c = togb * (Constants.CBekl - Constants.BeMin) / Constants.BeDiv + \ togr * (Constants.CRest - Constants.ReMin) / Constants.ReDiv + \ togbu * (Constants.CBuch - Constants.BuMin) / Constants.BuDiv to_bew_d = togb * (Constants.DBekl - Constants.BeMin) / Constants.BeDiv + \ togr * (Constants.DRest - Constants.ReMin) / Constants.ReDiv + \ togbu * (Constants.DBuch - Constants.BuMin) / Constants.BuDiv to_bew_e = togb * (Constants.EBekl - Constants.BeMin) / Constants.BeDiv + \ togr * (Constants.ERest - Constants.ReMin) / Constants.ReDiv + \ togbu * (Constants.EBuch - Constants.BuMin) / Constants.BuDiv to_template = ['A ( Bekleidung 90%, Restaurant 10%, Bücher 50% )', 'B ( Bekleidung 10%, Restaurant 50%, Bücher 90% )', 'C ( Bekleidung 50%, Restaurant 80%, Bücher 20% )', 'D ( Bekleidung 40%, Restaurant 40%, Bücher 50% )', 'E ( Bekleidung 60%, Restaurant 60%, Bücher 30% )'] to_t_template = ['A ( Bekleidung 90%, Restaurant 10%, Bücher 50% )', 'B ( Bekleidung 10%, Restaurant 50%, Bücher 90% )', 'C ( Bekleidung 50%, Restaurant 80%, Bücher 20% )', 'D ( Bekleidung 40%, Restaurant 40%, Bücher 50% )', 'E ( Bekleidung 60%, Restaurant 60%, Bücher 30% )'] to_nwa = [to_bew_a, to_bew_b, to_bew_c, to_bew_d, to_bew_e] to_nwa_rei = ['A', 'B', 'C', 'D', 'E'] for i in [0, 1, 2, 3, 4]: for j in [0, 1, 2, 3, 4]: if to_nwa[i] > to_nwa[j]: to_nwa_rei[i], to_nwa_rei[j] = to_nwa_rei[j], to_nwa_rei[i] to_nwa[i], to_nwa[j] = to_nwa[j], to_nwa[i] to_template[i], to_template[j] = to_template[j], to_template[i] print(to_nwa) print(to_nwa_rei) print(to_template) player.to_max = to_nwa_rei[0] wurzelBe = math.sqrt(0.9 ** 2 + 0.1 ** 2 + 0.5 ** 2 + 0.4 ** 2 + 0.6 ** 2) wurzelRe = math.sqrt(0.1 ** 2 + 0.5 ** 2 + 0.8 ** 2 + 0.4 ** 2 + 0.6 ** 2) wurzelBu = math.sqrt(0.5 ** 2 + 0.9 ** 2 + 0.2 ** 2 + 0.5 ** 2 + 0.3 ** 2) to_best_be = 0.9 * togb / wurzelBe to_schl_be = 0.1 * togb / wurzelBe to_best_re = 0.8 * togr / wurzelRe to_schl_re = 0.1 * togr / wurzelRe to_best_bu = 0.9 * togbu / wurzelBu to_schl_bu = 0.2 * togbu / wurzelBu toa_abst_best = math.sqrt((togb * Constants.ABekl / wurzelBe - to_best_be) ** 2 + (togr * Constants.ARest / wurzelRe - to_best_re) ** 2 + (togbu * Constants.ABuch / wurzelBu - to_best_bu) ** 2) toa_abst_schl = math.sqrt((togb * Constants.ABekl / wurzelBe - to_schl_be) ** 2 + (togr * Constants.ARest / wurzelRe - to_schl_re) ** 2 + (togbu * Constants.ABuch / wurzelBu - to_schl_bu) ** 2) tob_abst_best = math.sqrt((togb * Constants.BBekl / wurzelBe - to_best_be) ** 2 + (togr * Constants.BRest / wurzelRe - to_best_re) ** 2 + (togbu * Constants.BBuch / wurzelBu - to_best_bu) ** 2) tob_abst_schl = math.sqrt((togb * Constants.BBekl / wurzelBe - to_schl_be) ** 2 + (togr * Constants.BRest / wurzelRe - to_schl_re) ** 2 + (togbu * Constants.BBuch / wurzelBu - to_schl_bu) ** 2) toc_abst_best = math.sqrt((togb * Constants.CBekl / wurzelBe - to_best_be) ** 2 + (togr * Constants.CRest / wurzelRe - to_best_re) ** 2 + (togbu * Constants.CBuch / wurzelBu - to_best_bu) ** 2) toc_abst_schl = math.sqrt((togb * Constants.CBekl / wurzelBe - to_schl_be) ** 2 + (togr * Constants.CRest / wurzelRe - to_schl_re) ** 2 + (togbu * Constants.CBuch / wurzelBu - to_schl_bu) ** 2) tod_abst_best = math.sqrt((togb * Constants.DBekl / wurzelBe - to_best_be) ** 2 + (togr * Constants.DRest / wurzelRe - to_best_re) ** 2 + (togbu * Constants.DBuch / wurzelBu - to_best_bu) ** 2) tod_abst_schl = math.sqrt((togb * Constants.DBekl / wurzelBe - to_schl_be) ** 2 + (togr * Constants.DRest / wurzelRe - to_schl_re) ** 2 + (togbu * Constants.DBuch / wurzelBu - to_schl_bu) ** 2) toe_abst_best = math.sqrt((togb * Constants.EBekl / wurzelBe - to_best_be) ** 2 + (togr * Constants.ERest / wurzelRe - to_best_re) ** 2 + (togbu * Constants.EBuch / wurzelBu - to_best_bu) ** 2) toe_abst_schl = math.sqrt((togb * Constants.EBekl / wurzelBe - to_schl_be) ** 2 + (togr * Constants.ERest / wurzelRe - to_schl_re) ** 2 + (togbu * Constants.EBuch / wurzelBu - to_schl_bu) ** 2) toclosa = toa_abst_schl / (toa_abst_schl + toa_abst_best) toclosb = tob_abst_schl / (tob_abst_schl + tob_abst_best) toclosc = toc_abst_schl / (toc_abst_schl + toc_abst_best) toclosd = tod_abst_schl / (tod_abst_schl + tod_abst_best) toclose = toe_abst_schl / (toe_abst_schl + toe_abst_best) to_top = [toclosa, toclosb, toclosc, toclosd, toclose] to_top_rei = ['A', 'B', 'C', 'D', 'E'] for i in [0, 1, 2, 3, 4]: for j in [0, 1, 2, 3, 4]: if to_top[i] > to_top[j]: to_top_rei[i], to_top_rei[j] = to_top_rei[j], to_top_rei[i] to_top[i], to_top[j] = to_top[j], to_top[i] to_t_template[i], to_t_template[j] = to_t_template[j], to_t_template[i] player.to_t_max = to_top_rei[0] print(to_top) print(to_top_rei) print(to_t_template) return dict(to_template0=to_template[0], to_template1=to_template[1], to_template2=to_template[2], to_template3=to_template[3], to_template4=to_template[4], to_t_template0=to_t_template[0], to_t_template1=to_t_template[1], to_t_template2=to_t_template[2], to_t_template3=to_t_template[3], to_t_template4=to_t_template[4] ) class PaarEinleitung(Page): pass class PaarEingabe(Page): form_model = 'player' form_fields = ['paar_A_B', 'paar_A_C', 'paar_A_D', 'paar_A_E', 'paar_B_C', 'paar_B_D', 'paar_B_E', 'paar_C_D', 'paar_C_E', 'paar_D_E', 'Auswahl_Hilfe'] @staticmethod def error_message(player, values): print('values is', values) if values['paar_A_B'] == 1 and values['paar_A_C'] == 0 and values['paar_B_C'] == 1 \ and values['Auswahl_Hilfe'] == 1: return 'Wenn C besser oder gleich A (Vergl. 2) und A besser oder gleich B (Vergl. 1) ist, so muss auch C ' \ 'besser oder gleich B (Vergl. 5) sein. Ändern Sie bitte (Vergl. 5).' if values['paar_A_B'] == 0 and values['paar_A_C'] == 1 and values['paar_B_C'] == 0 \ and values['Auswahl_Hilfe'] == 1: return 'Wenn B besser oder gleich A (Vergl. 1) und A besser oder gleich C (Vergl. 2) ist, so muss auch B ' \ 'besser oder gleich C (Vergl. 5) sein. Ändern Sie bitte (Vergl. 5).' if values['paar_A_B'] == 1 and values['paar_A_D'] == 0 and values['paar_B_D'] == 1 \ and values['Auswahl_Hilfe'] == 1: return 'Wenn D besser oder gleich A (Vergl. 3) und A besser oder gleich B (Vergl. 1) ist, so muss auch D ' \ 'besser oder gleich B (Vergl. 6) sein. Ändern Sie bitte (Vergl. 6).' if values['paar_A_B'] == 0 and values['paar_A_D'] == 1 and values['paar_B_D'] == 0 \ and values['Auswahl_Hilfe'] == 1: return 'Wenn B besser oder gleich A (Vergl. 1) und A besser oder gleich D (Vergl. 3) ist, so muss auch B ' \ 'besser oder gleich D sein (Vergl. 6). Ändern Sie bitte (Vergl. 6).' if values['paar_A_B'] == 1 and values['paar_A_E'] == 0 and values['paar_B_E'] == 1 \ and values['Auswahl_Hilfe'] == 1: return 'Wenn E besser oder gleich A (Vergl. 4) und A besser oder gleich B (Vergl. 1) ist, so muss auch E ' \ 'besser oder gleich B (Vergl. 7) sein. Ändern Sie bitte (Vergl. 7).' if values['paar_A_B'] == 0 and values['paar_A_E'] == 1 and values['paar_B_E'] == 0 \ and values['Auswahl_Hilfe'] == 1: return 'Wenn B besser oder gleich A (Vergl. 1) und A besser oder gleich E (Vergl. 4) ist, so muss auch B ' \ 'besser oder gleich E sein (Vergl. 7) sein. Ändern Sie bitte (Vergl. 7).' if values['paar_A_C'] == 1 and values['paar_A_D'] == 0 and values['paar_C_D'] == 1 \ and values['Auswahl_Hilfe'] == 1: return 'Wenn D besser oder gleich A (Vergl. 3) und A besser oder gleich C (Vergl. 2) ist, so muss auch D ' \ 'besser oder gleich C sein (Vergl. 8). Ändern Sie bitte (Vergl. 8).' if values['paar_A_C'] == 0 and values['paar_A_D'] == 1 and values['paar_C_D'] == 0 \ and values['Auswahl_Hilfe'] == 1: return 'Wenn C besser oder gleich A (Vergl. 2) und A besser oder gleich D (Vergl. 3) ist, so muss C auch ' \ 'besser oder gleich D sein (Vergl. 8). Ändern Sie bitte (Vergl. 8). ' if values['paar_A_C'] == 1 and values['paar_A_E'] == 0 and values['paar_C_E'] == 1 \ and values['Auswahl_Hilfe'] == 1: return 'Wenn E besser oder gleich A (Vergl. 4) und A besser oder gleich C (Vergl. 3) ist, so muss auch E ' \ 'besser oder gleich C sein (Vergl. 9). Ändern Sie bitte (Vergl. 9).' if values['paar_A_C'] == 0 and values['paar_A_E'] == 1 and values['paar_C_E'] == 0 \ and values['Auswahl_Hilfe'] == 1: return 'Wenn C besser oder gleich A (Vergl. 3) und A besser oder gleich E (Vergl. 4) ist, so muss auch C ' \ 'besser oder gleich E sein (Vergl. 9). Ändern Sie bitte (Vergl. 9).' if values['paar_A_D'] == 1 and values['paar_A_E'] == 0 and values['paar_D_E'] == 1 \ and values['Auswahl_Hilfe'] == 1: return 'Wenn E besser oder gleich A (Vergl. 4) und A besser oder gleich D (Vergl. 3) ist, so muss auch E ' \ 'besser oder gleich D sein (Vergl. 10). Ändern Sie bitte (Vergl. 10).' if values['paar_A_D'] == 0 and values['paar_A_E'] == 1 and values['paar_D_E'] == 0 \ and values['Auswahl_Hilfe'] == 1: return 'Wenn D besser oder gleich A (Vergl. 3) und A besser oder gleich E (Vergl. 4) ist, so muss auch D ' \ 'besser oder gleich E sein (Vergl. 10). Ändern Sie bitte (Vergl. 10).' if values['paar_B_C'] == 1 and values['paar_B_D'] == 0 and values['paar_C_D'] == 1 \ and values['Auswahl_Hilfe'] == 1: return 'Wenn D besser oder gleich B (Vergl. 6) und B besser oder gleich C (Vergl. 5) ist, so muss auch D ' \ 'besser oder gleich C sein (Vergl. 8). Ändern Sie bitte (Vergl. 8).' if values['paar_B_C'] == 0 and values['paar_B_D'] == 1 and values['paar_C_D'] == 0 \ and values['Auswahl_Hilfe'] == 1: return 'Wenn C besser oder gleich B (Vergl. 5) und B besser oder gleich D (Vergl. 6) ist, so muss auch C ' \ 'besser oder gleich D sein (Vergl. 8). Ändern Sie bitte (Vergl. 8).' if values['paar_B_D'] == 1 and values['paar_B_E'] == 0 and values['paar_D_E'] == 1 \ and values['Auswahl_Hilfe'] == 1: return 'Wenn E besser oder gleich B (Vergl. 7) und B besser oder gleich D (Vergl. 6) ist, so muss auch E ' \ 'besser oder gleich D sein (Vergl. 10). Ändern Sie bitte (Vergl. 10).' if values['paar_B_D'] == 0 and values['paar_B_E'] == 1 and values['paar_D_E'] == 0 \ and values['Auswahl_Hilfe'] == 1: return 'Wenn D besser oder gleich B (Vergl. 6) und B besser oder gleich E (Vergl. 7) ist, so muss auch D ' \ 'besser oder gleich E sein (Vergl. 10). Ändern Sie bitte (Vergl. 10).' if values['paar_B_C'] == 1 and values['paar_B_E'] == 0 and values['paar_C_E'] == 1 \ and values['Auswahl_Hilfe'] == 1: return 'Wenn E besser oder gleich B (Vergl. 7) und B besser oder gleich C (Vergl. 5) ist, so muss auch E ' \ 'besser oder gleich C sein (Vergl. 9). Ändern Sie bitte (Vergl. 9).' if values['paar_B_C'] == 0 and values['paar_B_E'] == 1 and values['paar_C_E'] == 0 \ and values['Auswahl_Hilfe'] == 1: return 'Wenn C besser oder gleich B (Vergl. 5) und B besser oder gleich E (Vergl. 7) ist, so muss auch C ' \ 'besser oder gleich E sein (Vergl. 9). Ändern Sie bitte (Vergl. 9).' if values['paar_C_D'] == 1 and values['paar_C_E'] == 0 and values['paar_D_E'] == 1 \ and values['Auswahl_Hilfe'] == 1: return 'Wenn E besser oder gleich C (Vergl. 9) und C besser oder gleich D (Vergl. 8) ist, so muss auch E ' \ 'besser oder gleich D sein (Vergl. 10). Ändern Sie bitte (Vergl. 10).' if values['paar_C_D'] == 0 and values['paar_C_E'] == 1 and values['paar_D_E'] == 0 \ and values['Auswahl_Hilfe'] == 1: return 'Wenn D besser oder gleich C (Vergl. 8) und C besser oder gleich E (Vergl. 9) ist, so muss auch D ' \ 'besser oder gleich E sein (Vergl. 10). Ändern Sie bitte (Vergl. 10).' class PaarResults(Page): form_model = 'player' form_fields = ['paar_verstaendlich', 'paar_zufrieden', 'paar_vertrauen'] @staticmethod def vars_for_template(player): import random player.z1 = random.uniform(1, 6) player.z3 = random.uniform(0, 100) player.z4 = random.uniform(0, 100) player.z5 = random.uniform(0, 100) player.z2 = random.uniform(0, 1) pos_a = player.paar_A_B + player.paar_A_C + player.paar_A_D + player.paar_A_E pos_b = 1 - player.paar_A_B + player.paar_B_C + player.paar_B_D + player.paar_B_E pos_c = 1 - player.paar_A_C + 1 - player.paar_B_C + player.paar_C_D + player.paar_C_E pos_d = 1 - player.paar_A_D + 1 - player.paar_B_D + 1 - player.paar_C_D + player.paar_D_E pos_e = 1 - player.paar_A_E + 1 - player.paar_B_E + 1 - player.paar_C_E + 1 - player.paar_D_E paar_bew = [pos_a, pos_b, pos_c, pos_d, pos_e] paar_rei = ['A', 'B', 'C', 'D', 'E'] paar_template = ['A ( Bekleidung 90%, Restaurant 10%, Bücher 50% )', 'B ( Bekleidung 10%, Restaurant 50%, Bücher 90% )', 'C ( Bekleidung 50%, Restaurant 80%, Bücher 20% )', 'D ( Bekleidung 40%, Restaurant 40%, Bücher 50% )', 'E ( Bekleidung 60%, Restaurant 60%, Bücher 30% )'] for i in [0, 1, 2, 3, 4]: for j in [0, 1, 2, 3, 4]: if paar_bew[i] > paar_bew[j]: paar_bew[i], paar_bew[j] = paar_bew[j], paar_bew[i] paar_rei[i], paar_rei[j] = paar_rei[j], paar_rei[i] paar_template[i], paar_template[j] = paar_template[j], paar_template[i] if paar_bew[0] != 4: player.paar_max = 'K' print(paar_rei) print(paar_bew) player.paar_max = paar_rei[0] return dict(paar_template0=paar_template[0], paar_template1=paar_template[1], paar_template2=paar_template[2], paar_template3=paar_template[3], paar_template4=paar_template[4], PaarMax=paar_bew[0] ) class Resultate(Page): @staticmethod def vars_for_template(player): anzahl = 0 player.gutschein = ' leider kein Gutschein ' if 1 < player.z1 <= 2: player.verfahren = 'SMART' if player.smart_nwa_zufrieden >= player.smart_top_zufrieden: player.verlosung = player.smart_max else: player.verlosung = player.smart_t_max if 2 < player.z1 <= 3: player.verfahren = 'Swing' if player.smart_nwa_zufrieden >= player.smart_top_zufrieden: player.verlosung = player.swing_max else: player.verlosung = player.swing_t_max if 3 < player.z1 <= 4: player.verfahren = 'TradeOff' if player.trade_off_nwa_zufrieden >= player.trade_off_top_zufrieden: player.verlosung = player.to_max else: player.verlosung = player.to_t_max if 4 < player.z1 <= 5: player.verfahren = 'direkter Vergleich' if player.ahp_nwa_zufrieden >= player.ahp_top_zufrieden: player.verlosung = player.ahp_max else: player.verlosung = player.ahp_t_max if 5 < player.z1 <= 6: player.verfahren = 'Paar Vergleich' player.verlosung = player.paar_max if player.verlosung == 'A': if 0 <= player.z3 < 90: player.gutschein = ' der Gutschein für Bekleidungsartikel ' anzahl = anzahl + 1 if 0 <= player.z4 < 10: anzahl = anzahl + 1 if anzahl == 2: player.gutschein = ' der Gutschein für Bekleidungsartikel und den Restaurantgutschein ' else: player.gutschein = ' der Restaurantgutschein ' if 0 <= player.z5 <= 50: if anzahl == 0: player.gutschein = ' der Büchergutschein ' else: player.gutschein = player.gutschein + 'und der Büchergutschein ' if player.verlosung == 'B': if 0 <= player.z3 < 10: player.gutschein = ' der Gutschein für Bekleidungsartikel ' anzahl = anzahl + 1 if 0 <= player.z4 < 50: anzahl = anzahl + 1 if anzahl == 2: player.gutschein = ' der Gutschein für Bekleidungsartikel und der Restaurantgutschein ' else: player.gutschein = ' der Restaurantgutschein ' if 0 <= player.z5 <= 90: if anzahl == 0: player.gutschein = ' der Büchergutschein ' else: player.gutschein = player.gutschein + 'und der Büchergutschein ' if player.verlosung == 'C': if 0 <= player.z3 < 50: player.gutschein = ' der Gutschein für Bekleidungsartikel ' anzahl = anzahl + 1 if 0 <= player.z4 < 80: anzahl = anzahl + 1 if anzahl == 2: player.gutschein = ' der Gutschein für Bekleidungsartikel und der Restaurantgutschein ' else: player.gutschein = ' der Restaurantgutschein ' if 0 <= player.z5 <= 20: if anzahl == 0: player.gutschein = ' der Büchergutschein ' else: player.gutschein = player.gutschein + 'und der Büchergutschein ' if player.verlosung == 'D': if 0 <= player.z3 < 40: player.gutschein = ' der Gutschein für Bekleidungsartikel ' anzahl = anzahl + 1 if 0 <= player.z4 < 40: anzahl = anzahl + 1 if anzahl == 2: player.gutschein = ' der Gutschein für Bekleidungsartikel und der Restaurantgutschein ' else: player.gutschein = ' der Restaurantgutschein ' if 0 <= player.z5 <= 50: if anzahl == 0: player.gutschein = ' der Büchergutschein ' else: player.gutschein = player.gutschein + 'und der Büchergutschein ' if player.verlosung == 'E': if 0 <= player.z3 < 60: player.gutschein = ' der Gutschein für Bekleidungsartikel ' anzahl = anzahl + 1 if 0 <= player.z4 < 60: anzahl = anzahl + 1 if anzahl == 2: player.gutschein = ' der Gutschein für Bekleidungsartikel und den Restaurantgutschein ' else: player.gutschein = ' der Restaurantgutschein ' if 0 <= player.z5 <= 30: if anzahl == 0: player.gutschein = ' der Büchergutschein ' else: player.gutschein = player.gutschein + 'und der Büchergutschein ' if 0 <= player.z2 < 1: player.gewinner = 'gewonnen' if 1 <= player.z2 < 2: player.gewinner = 'nicht gewonnen' return dict(verfahren=player.verfahren, verlosung=player.verlosung, gutschein=player.gutschein, gewinner=player.gewinner, anzahl=anzahl, abholcode=player.abholcode) #page_sequence = [Demographics] page_sequence = [Information1, Information2, PaarEinleitung, PaarEingabe, PaarResults, SmartEingabe, SmartResults, AHPEingabe1, AHPEingabe2, AHPEingabe3, AHPResults, SwingEingabe, SwingResults, TradeOffEingabe1, TradeOffEingabe2, TradeOffResults, Resultate, Demographics]