whitecode12

expertsystem

Oct 14th, 2024
26
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 26.93 KB | Source Code | 0 0
  1. from flask import Flask, render_template, request, session, url_for, redirect
  2.  
  3. app = Flask(__name__)
  4. app.config["SECRET_KEY"] = "iniSecretKey"
  5. nilaiku = 100
  6. qpertama = "ya"
  7. suasana = "senang"
  8.  
  9. # Hasil Analisa
  10. M01 = "PRESENSI TIDAK TERBACA"
  11. M02 = "Pindah lokasi absen"
  12. M03 = "Tidak bisa absen"
  13. M04 = "Absen non OPD"
  14. M05 = "Tidak bisa login aplikasi e-Kinerja"
  15. M06 = "Tidak bisa input aktifitas aplikasi e-Kinerja"
  16. M07 = "Tambahan Penghasilan Pegawai (TPP) kurang di aplikasi e-Kinerja"
  17. M08 = "Tidak bisa login aplikasi e-SPPD"
  18. M09 = "Data salah di aplikasi e-SPPD"
  19. M10 = "Pembatalan Telahanan Staf (TS)"
  20. M11 = "Mesin Finger tidak terhubung"
  21. M12 = "Jaringan Internet terputus"
  22. M13 = "Problems tidak diketahui"
  23.  
  24. # halaman depan
  25. @app.route("/")
  26. def index():
  27.     return render_template("depan.html")
  28.  
  29. # halaman login
  30. @app.route("/login", methods=["POST", "GET"])
  31. def login():
  32.     if "email" in session:
  33.         return redirect(url_for('sukses_req'))
  34.     else:
  35.         # jika tombol di klik -> request post
  36.         if request.method == 'POST':
  37.             email = request.form['email']
  38.             password = request.form['password']
  39.             if email == 'admin@gmail.com' and password == 'pass':
  40.                 session['email'] = email
  41.                 return redirect(url_for('userai'))
  42.             else:
  43.                 #harus login dulu
  44.                 return redirect(url_for('login'))
  45.     return render_template("login.html")
  46.  
  47. # halaman logout
  48. @app.route("/logout")
  49. def logout_akun():
  50.     try:
  51.         session.pop("email")
  52.         session.pop("nip")
  53.         session.pop("nama")
  54.         session.pop("pangkat")
  55.         session.pop("jabatan")
  56.         return redirect(url_for("login"))
  57.     except :
  58.         return redirect(url_for("login"))
  59.  
  60. # halaman sukses
  61. @app.route("/sukses")
  62. def sukses_req():
  63.     nilai = " Anda Sukses Login"
  64.     return render_template("sukses.html", nilai=nilai)
  65.  
  66. # halaman input data pengguna
  67. @app.route("/user", methods=["POST", "GET"])
  68. def userai():
  69.     if request.method == 'POST':
  70.         nip = request.form['fnip']
  71.         nama = request.form['fnama']
  72.         jabatan = request.form['fjabatan']
  73.         pangkat = request.form['fpangkat']
  74.         session['nip'] = nip
  75.         session['nama'] = nama
  76.         session['jabatan'] = jabatan
  77.         session['pangkat'] = pangkat
  78.         return render_template("sukses.html")
  79.     else:
  80.         return render_template("user.html")
  81.  
  82. # halaman YA1
  83. @app.route("/suksesya")
  84. def Ya_req():
  85.     nilai = " Anda Sukses Pilih Ya"
  86.     return render_template("sukses.html", nilai=nilai)
  87.  
  88. # halaman petunjuk
  89. @app.route("/petunjuk")
  90. def petunjuk():
  91.     return render_template("petunjuk.html")
  92.  
  93. # halaman hasil 1
  94. @app.route("/hasil")
  95. def hasil():
  96.         session['report'] = M01
  97.         datahasil = session['report']
  98.         datanip = session['nip']
  99.         datanama = session['nama']
  100.         datajabatan = session['jabatan']
  101.         datapangkat = session['pangkat']
  102.         return render_template("hasil.html", nilai=M01, datanip=datanip, datanama=datanama, datajabatan=datajabatan, datapangkat=datapangkat )
  103.  
  104. # halaman hasil 2
  105. @app.route("/hasil2")
  106. def hasil2():
  107.         return render_template("m02.html", nilai=M02)
  108.  
  109. # halaman hasil 3
  110. @app.route("/hasil3")
  111. def hasil3():
  112.         return render_template("m03.html", nilai=M03)
  113.  
  114. # halaman hasil 4
  115. @app.route("/hasil4")
  116. def hasil4():
  117.         return render_template("m04.html", nilai=M04)
  118.  
  119. # halaman hasil 5
  120. @app.route("/hasil5")
  121. def hasil5():
  122.         return render_template("m05.html", nilai=M05)
  123.  
  124. # halaman hasil 6
  125. @app.route("/hasil6")
  126. def hasil6():
  127.         return render_template("m06.html", nilai=M06)
  128.  
  129. # halaman hasil 7
  130. @app.route("/hasil7")
  131. def hasil7():
  132.         return render_template("m07.html", nilai=M07)
  133.  
  134. # halaman hasil 8
  135. @app.route("/hasil8")
  136. def hasil8():
  137.         return render_template("m08.html", nilai=M08)
  138.  
  139. # halaman hasil 9
  140. @app.route("/hasil9")
  141. def hasil9():
  142.         return render_template("m09.html", nilai=M09)
  143.  
  144. # halaman hasil 10
  145. @app.route("/hasil10")
  146. def hasil10():
  147.         return render_template("m10.html", nilai=M10)
  148.  
  149. # halaman hasil 11
  150. @app.route("/hasil11")
  151. def hasil11():
  152.         return render_template("m11.html", nilai=M11)
  153.  
  154. # halaman hasil 12
  155. @app.route("/hasil12")
  156. def hasil12():
  157.         return render_template("m12.html", nilai=M12)
  158.  
  159. # halaman hasil 12
  160. @app.route("/hasilbaru")
  161. def hasilbaru():
  162.         return render_template("mbaru.html", nilai=M13)
  163.  
  164.  
  165.  
  166. ###### JALANKAN PROGRAM PERTAMA DISINI
  167. @app.route("/checkuppertama", methods=["POST", "GET"])
  168. def checkuppertama():
  169.     return render_template("index.html")
  170.  
  171. ###### JALANKAN PROGRAM PERTANYAAN PERTAMA
  172. @app.route("/indexku", methods=["POST", "GET"])
  173. def checkup():
  174.     # looping
  175.     # hari = ['senin', 'selasa', 'rabu', 'kamis', 'jumat', 'sabtu', 'minggu']
  176.     # return render_template("index.html", value=hari, nilai=nilaiku, suasana=suasana, qpertama=qpertama)
  177.     #jika tombol button di klik -> request POST
  178.     if request.method == 'POST':
  179.         jawaban1 = request.form['qsatu']
  180.         if jawaban1 == 'Ya' :
  181.             session['qsatu'] = jawaban1
  182.             return redirect(url_for('question2'))
  183.         elif jawaban1 == 'Pilih Jawaban' :
  184.             session['qsatu'] = jawaban1
  185.             return redirect(url_for('hasil'))
  186.         else:
  187.             #harus pilih jawaban dulu
  188.             return redirect(url_for('question2'))
  189.     return render_template("index.html")
  190.  
  191. @app.route("/contact")
  192. def contactku():
  193.     return render_template("contact.html")
  194.  
  195. @app.route("/about")
  196. def aboutku():
  197.     if "email" in session:
  198.         return render_template("about.html")
  199.     else:
  200.         return redirect(url_for('login'))    
  201.  
  202. # session
  203. @app.route("/halaman/<int:angka>")
  204. def session_1(angka):
  205.     session["nilaiku"] = angka
  206.     return "Berhasil mengeset isi nilaiku"
  207.  
  208. @app.route("/halaman/lihat")
  209. def view_session_1():
  210.         try:
  211.             data = session["nilaiku"]
  212.             return "Nilai yang sudah di set adalah = {}".format(data)
  213.         except:
  214.             return "Anda tidak memiliki nilaiku lagi"
  215.  
  216. @app.route("/halaman/logout")
  217. def logout_session_1():
  218.     session.pop("nilaiku")
  219.     return "Session berhasil dihapus"
  220.  
  221. @app.route("/Pertanyaan02", methods=["POST", "GET"])
  222. def question2():
  223.     if request.method == 'POST':
  224.         jawaban2 = request.form['qdua']
  225.         if jawaban2 == 'Ya' :
  226.             session['qdua'] = jawaban2
  227.             return redirect(url_for('hasil'))
  228.         elif jawaban2 == 'Pilih Jawaban' :
  229.             session['qdua'] = jawaban2
  230.             return redirect(url_for('hasil'))
  231.         else:
  232.             #harus pilih jawaban dulu
  233.             return redirect(url_for('question3'))
  234.     return render_template("s02.html")
  235.  
  236. @app.route("/Pertanyaan03", methods=["POST", "GET"])
  237. def question3():
  238.     if request.method == 'POST':
  239.         jawaban3 = request.form['qtiga']
  240.         if jawaban3 == 'Ya' :
  241.             session['qtiga'] = jawaban3
  242.             return redirect(url_for('hasil'))
  243.         elif jawaban3 == 'Pilih Jawaban' :
  244.             session['qtiga'] = jawaban3
  245.             return redirect(url_for('hasil'))
  246.         else:
  247.             #harus pilih jawaban dulu
  248.             return redirect(url_for('question4'))
  249.     return render_template("s03.html")
  250.  
  251. @app.route("/Pertanyaan04", methods=["POST", "GET"])
  252. def question4():
  253.     if request.method == 'POST':
  254.         jawaban4 = request.form['qempat']
  255.         if jawaban4 == 'Ya' :
  256.             session['qempat'] = jawaban4
  257.             return redirect(url_for('hasil'))
  258.         elif jawaban4 == 'Pilih Jawaban' :
  259.             session['qempat'] = jawaban4
  260.             return redirect(url_for('hasil'))
  261.         else:
  262.             #harus pilih jawaban dulu
  263.             return redirect(url_for('question5'))
  264.     return render_template("s04.html")
  265.  
  266. @app.route("/Pertanyaan05", methods=["POST", "GET"])
  267. def question5():
  268.     if request.method == 'POST':
  269.         jawaban5 = request.form['qlima']
  270.         if jawaban5 == 'Ya' :
  271.             session['qlima'] = jawaban5
  272.             return redirect(url_for('hasil'))
  273.         elif jawaban5 == 'Pilih Jawaban' :
  274.             session['qlima'] = jawaban5
  275.             return redirect(url_for('hasil'))
  276.         else:
  277.             #harus pilih jawaban dulu
  278.             return redirect(url_for('question6'))
  279.     return render_template("s05.html")
  280.  
  281. @app.route("/Pertanyaan06", methods=["POST", "GET"])
  282. def question6():
  283.     if request.method == 'POST':
  284.         jawaban6 = request.form['qenam']
  285.         if jawaban6 == 'Ya' :
  286.             session['qenam'] = jawaban6
  287.             return redirect(url_for('question7'))
  288.         elif jawaban6 == 'Pilih Jawaban' :
  289.             session['qenam'] = jawaban6
  290.             return redirect(url_for('hasil'))
  291.         else:
  292.             #harus pilih jawaban dulu
  293.             return redirect(url_for('question9'))
  294.     return render_template("s06.html")
  295.  
  296. @app.route("/Pertanyaan07", methods=["POST", "GET"])
  297. def question7():
  298.     if request.method == 'POST':
  299.         jawaban7 = request.form['qtujuh']
  300.         if jawaban7 == 'Ya' :
  301.             session['qtujuh'] = jawaban7
  302.             return redirect(url_for('question8'))
  303.         elif jawaban7 == 'Pilih Jawaban' :
  304.             session['qtujuh'] = jawaban7
  305.             return redirect(url_for('hasil'))
  306.         else:
  307.             #harus pilih jawaban dulu
  308.             return redirect(url_for('question9'))
  309.     return render_template("s07.html")
  310.  
  311. @app.route("/Pertanyaan08", methods=["POST", "GET"])
  312. def question8():
  313.     if request.method == 'POST':
  314.         jawaban8 = request.form['qdelapan']
  315.         if jawaban8 == 'Ya' :
  316.             session['qdelapan'] = jawaban8
  317.             return redirect(url_for('hasil2'))
  318.         elif jawaban8 == 'Pilih Jawaban' :
  319.             session['qdelapan'] = jawaban8
  320.             return redirect(url_for('hasil'))
  321.         else:
  322.             #harus pilih jawaban dulu
  323.             return redirect(url_for('question9'))
  324.     return render_template("s08.html")
  325.  
  326. @app.route("/Pertanyaan09", methods=["POST", "GET"])
  327. def question9():
  328.     if request.method == 'POST':
  329.         jawaban9 = request.form['qsembilan']
  330.         if jawaban9 == 'Ya' :
  331.             session['qsembilan'] = jawaban9
  332.             return redirect(url_for('hasil3'))
  333.         elif jawaban9 == 'Pilih Jawaban' :
  334.             session['qsembilan'] = jawaban9
  335.             return redirect(url_for('hasil'))
  336.         else:
  337.             #harus pilih jawaban dulu
  338.             return redirect(url_for('question10'))
  339.     return render_template("s09.html")
  340.  
  341. @app.route("/Pertanyaan010", methods=["POST", "GET"])
  342. def question10():
  343.     if request.method == 'POST':
  344.         jawaban10 = request.form['qsepuluh']
  345.         if jawaban10 == 'Ya' :
  346.             session['qsepuluh'] = jawaban10
  347.             return redirect(url_for('question11'))
  348.         elif jawaban10 == 'Pilih Jawaban' :
  349.             session['qsepuluh'] = jawaban10
  350.             return redirect(url_for('hasil'))
  351.         else:
  352.             #harus pilih jawaban dulu
  353.             return redirect(url_for('question13'))
  354.     return render_template("s10.html")
  355.  
  356. @app.route("/Pertanyaan011", methods=["POST", "GET"])
  357. def question11():
  358.     if request.method == 'POST':
  359.         jawaban11 = request.form['qsebelas']
  360.         if jawaban11 == 'Ya' :
  361.             session['qsebelas'] = jawaban11
  362.             return redirect(url_for('hasil3'))
  363.         elif jawaban11 == 'Pilih Jawaban' :
  364.             session['qsebelas'] = jawaban11
  365.             return redirect(url_for('hasil'))
  366.         else:
  367.             #harus pilih jawaban dulu
  368.             return redirect(url_for('question13'))
  369.     return render_template("s11.html")
  370.  
  371. @app.route("/Pertanyaan012", methods=["POST", "GET"])
  372. def question12():
  373.     if request.method == 'POST':
  374.         jawaban12 = request.form['qduabelas']
  375.         if jawaban12 == 'Ya' :
  376.             session['qduabelas'] = jawaban12
  377.             return redirect(url_for('hasil4'))
  378.         elif jawaban12 == 'Pilih Jawaban' :
  379.             session['qduabelas'] = jawaban12
  380.             return redirect(url_for('hasil'))
  381.         else:
  382.             #harus pilih jawaban dulu
  383.             return redirect(url_for('question14'))
  384.     return render_template("s12.html")
  385.  
  386. @app.route("/Pertanyaan013", methods=["POST", "GET"])
  387. def question13():
  388.     if request.method == 'POST':
  389.         jawaban13 = request.form['qtigabelas']
  390.         if jawaban13 == 'Ya' :
  391.             session['qtigabelas'] = jawaban13
  392.             return redirect(url_for('hasil5'))
  393.         elif jawaban13 == 'Pilih Jawaban' :
  394.             session['qtigabelas'] = jawaban13
  395.             return redirect(url_for('hasil'))
  396.         else:
  397.             #harus pilih jawaban dulu
  398.             return redirect(url_for('question11A'))
  399.     return render_template("s13.html")
  400.  
  401. @app.route("/Pertanyaan11A", methods=["POST", "GET"])
  402. def question11A():
  403.     if request.method == 'POST':
  404.         jawaban11A = request.form['qsebelasA']
  405.         if jawaban11A == 'Ya' :
  406.             session['qsebelasA'] = jawaban11A
  407.             return redirect(url_for('question12'))
  408.         elif jawaban11A == 'Pilih Jawaban' :
  409.             session['qsebelasA'] = jawaban11A
  410.             return redirect(url_for('hasil'))
  411.         else:
  412.             #harus pilih jawaban dulu
  413.             return redirect(url_for('question14'))
  414.     return render_template("s11A.html")
  415.  
  416. @app.route("/Pertanyaan014", methods=["POST", "GET"])
  417. def question14():
  418.     if request.method == 'POST':
  419.         jawaban14 = request.form['qempatbelas']
  420.         if jawaban14 == 'Ya' :
  421.             session['qempatbelas'] = jawaban14
  422.             return redirect(url_for('question15'))
  423.         elif jawaban14 == 'Pilih Jawaban' :
  424.             session['qempatbelas'] = jawaban14
  425.             return redirect(url_for('hasil'))
  426.         else:
  427.             #harus pilih jawaban dulu
  428.             return redirect(url_for('question16'))
  429.     return render_template("s14.html")
  430.  
  431. @app.route("/Pertanyaan015", methods=["POST", "GET"])
  432. def question15():
  433.     if request.method == 'POST':
  434.         jawaban15 = request.form['qlimabelas']
  435.         if jawaban15 == 'Ya' :
  436.             session['qlimabelas'] = jawaban15
  437.             return redirect(url_for('hasil5'))
  438.         elif jawaban15 == 'Pilih Jawaban' :
  439.             session['qlimabelas'] = jawaban15
  440.             return redirect(url_for('hasil'))
  441.         else:
  442.             #harus pilih jawaban dulu
  443.             return redirect(url_for('question16'))
  444.     return render_template("s15.html")
  445.  
  446. @app.route("/Pertanyaan016", methods=["POST", "GET"])
  447. def question16():
  448.     if request.method == 'POST':
  449.         jawaban16 = request.form['qenambelas']
  450.         if jawaban16 == 'Ya' :
  451.             session['qenambelas'] = jawaban16
  452.             return redirect(url_for('hasil5'))
  453.         elif jawaban16 == 'Pilih Jawaban' :
  454.             session['qenambelas'] = jawaban16
  455.             return redirect(url_for('hasil'))
  456.         else:
  457.             #harus pilih jawaban dulu
  458.             return redirect(url_for('question5A'))
  459.     return render_template("s16.html")
  460.  
  461. @app.route("/Pertanyaan05A", methods=["POST", "GET"])
  462. def question5A():
  463.     if request.method == 'POST':
  464.         jawaban5A = request.form['qlimaA']
  465.         if jawaban5A == 'Ya' :
  466.             session['qlimaA'] = jawaban5A
  467.             return redirect(url_for('question19'))
  468.         elif jawaban5A == 'Pilih Jawaban' :
  469.             session['qlimaA'] = jawaban5A
  470.             return redirect(url_for('hasil'))
  471.         else:
  472.             #harus pilih jawaban dulu
  473.             return redirect(url_for('question17'))
  474.     return render_template("s05A.html")
  475.  
  476.  
  477.  
  478. @app.route("/Pertanyaan12A", methods=["POST", "GET"])
  479. def question12A():
  480.     if request.method == 'POST':
  481.         jawaban12A = request.form['qduabelasA']
  482.         if jawaban12A == 'Ya' :
  483.             session['qduabelasA'] = jawaban12A
  484.             return redirect(url_for('hasil4'))
  485.         elif jawaban12A == 'Pilih Jawaban' :
  486.             session['qduabelasA'] = jawaban12A
  487.             return redirect(url_for('hasil'))
  488.         else:
  489.             #harus pilih jawaban dulu
  490.             return redirect(url_for('question17'))
  491.     return render_template("s12A.html")
  492.  
  493. @app.route("/Pertanyaan017", methods=["POST", "GET"])
  494. def question17():
  495.     if request.method == 'POST':
  496.         jawaban17 = request.form['qtujuhbelas']
  497.         if jawaban17 == 'Ya' :
  498.             session['qtujuhbelas'] = jawaban17
  499.             return redirect(url_for('question18'))
  500.         elif jawaban17 == 'Pilih Jawaban' :
  501.             session['qtujuhbelas'] = jawaban17
  502.             return redirect(url_for('hasil'))
  503.         else:
  504.             #harus pilih jawaban dulu
  505.             return redirect(url_for('question21'))
  506.     return render_template("s17.html")
  507.  
  508. @app.route("/Pertanyaan018", methods=["POST", "GET"])
  509. def question18():
  510.     if request.method == 'POST':
  511.         jawaban18 = request.form['qdelapanbelas']
  512.         if jawaban18 == 'Ya' :
  513.             session['qdelapanbelas'] = jawaban18
  514.             return redirect(url_for('question20'))
  515.         elif jawaban18 == 'Pilih Jawaban' :
  516.             session['qdelapanbelas'] = jawaban18
  517.             return redirect(url_for('hasil'))
  518.         else:
  519.             #harus pilih jawaban dulu
  520.             return redirect(url_for('question21'))
  521.     return render_template("s18.html")
  522.  
  523. @app.route("/Pertanyaan019", methods=["POST", "GET"])
  524. def question19():
  525.     if request.method == 'POST':
  526.         jawaban19 = request.form['qsembilanbelas']
  527.         if jawaban19 == 'Ya' :
  528.             session['qsembilanbelas'] = jawaban19
  529.             return redirect(url_for('hasil6'))
  530.         elif jawaban19 == 'Pilih Jawaban' :
  531.             session['qsembilanbelas'] = jawaban19
  532.             return redirect(url_for('hasil'))
  533.         else:
  534.             #harus pilih jawaban dulu
  535.             return redirect(url_for('question17'))
  536.     return render_template("s19.html")
  537.  
  538. @app.route("/Pertanyaan020", methods=["POST", "GET"])
  539. def question20():
  540.     if request.method == 'POST':
  541.         jawaban20 = request.form['qduapuluh']
  542.         if jawaban20 == 'Ya' :
  543.             session['qduapuluh'] = jawaban20
  544.             return redirect(url_for('hasil6'))
  545.         elif jawaban20 == 'Pilih Jawaban' :
  546.             session['qduapuluh'] = jawaban20
  547.             return redirect(url_for('hasil'))
  548.         else:
  549.             #harus pilih jawaban dulu
  550.             return redirect(url_for('question21'))
  551.     return render_template("s20.html")
  552.  
  553. @app.route("/Pertanyaan021", methods=["POST", "GET"])
  554. def question21():
  555.     if request.method == 'POST':
  556.         jawaban21 = request.form['qduapuluhsatu']
  557.         if jawaban21 == 'Ya' :
  558.             session['qduapuluhsatu'] = jawaban21
  559.             return redirect(url_for('question22'))
  560.         elif jawaban21 == 'Pilih Jawaban' :
  561.             session['qduapuluhsatu'] = jawaban21
  562.             return redirect(url_for('hasil'))
  563.         else:
  564.             #harus pilih jawaban dulu
  565.             return redirect(url_for('question13A'))
  566.     return render_template("s21.html")
  567.  
  568. @app.route("/Pertanyaan022", methods=["POST", "GET"])
  569. def question22():
  570.     if request.method == 'POST':
  571.         jawaban22 = request.form['qduapuluhdua']
  572.         if jawaban22 == 'Ya' :
  573.             session['qduapuluhdua'] = jawaban22
  574.             return redirect(url_for('hasil7'))
  575.         elif jawaban22 == 'Pilih Jawaban' :
  576.             session['qduapuluhdua'] = jawaban22
  577.             return redirect(url_for('hasil'))
  578.         else:
  579.             #harus pilih jawaban dulu
  580.             return redirect(url_for('question13A'))
  581.     return render_template("s22.html")
  582.  
  583. @app.route("/Pertanyaan013A", methods=["POST", "GET"])
  584. def question13A():
  585.     if request.method == 'POST':
  586.         jawaban13A = request.form['qtigabelasA']
  587.         if jawaban13A == 'Ya' :
  588.             session['qtigabelasA'] = jawaban13A
  589.             return redirect(url_for('question23'))
  590.         elif jawaban13A == 'Pilih Jawaban' :
  591.             session['qtigabelas'] = jawaban13A
  592.             return redirect(url_for('hasil'))
  593.         else:
  594.             #harus pilih jawaban dulu
  595.             return redirect(url_for('question24'))
  596.     return render_template("s13A.html")
  597.  
  598. @app.route("/Pertanyaan023", methods=["POST", "GET"])
  599. def question23():
  600.     if request.method == 'POST':
  601.         jawaban23 = request.form['qduapuluhtiga']
  602.         if jawaban23 == 'Ya' :
  603.             session['qduapuluhtiga'] = jawaban23
  604.             return redirect(url_for('hasil8'))
  605.         elif jawaban23 == 'Pilih Jawaban' :
  606.             session['qduapuluhtiga'] = jawaban23
  607.             return redirect(url_for('hasil'))
  608.         else:
  609.             #harus pilih jawaban dulu
  610.             return redirect(url_for('question24'))
  611.     return render_template("s23.html")
  612.  
  613. @app.route("/Pertanyaan024", methods=["POST", "GET"])
  614. def question24():
  615.     if request.method == 'POST':
  616.         jawaban24 = request.form['qduapuluhempat']
  617.         if jawaban24 == 'Ya' :
  618.             session['qduapuluhempat'] = jawaban24
  619.             return redirect(url_for('hasil8'))
  620.         elif jawaban24 == 'Pilih Jawaban' :
  621.             session['qduapuluhempat'] = jawaban24
  622.             return redirect(url_for('hasil'))
  623.         else:
  624.             #harus pilih jawaban dulu
  625.             return redirect(url_for('question25'))
  626.     return render_template("s24.html")
  627.  
  628. @app.route("/Pertanyaan025", methods=["POST", "GET"])
  629. def question25():
  630.     if request.method == 'POST':
  631.         jawaban25 = request.form['qduapuluhlima']
  632.         if jawaban25 == 'Ya' :
  633.             session['qduapuluhlima'] = jawaban25
  634.             return redirect(url_for('question26'))
  635.         elif jawaban25 == 'Pilih Jawaban' :
  636.             session['qduapuluhlima'] = jawaban25
  637.             return redirect(url_for('hasil'))
  638.         else:
  639.             #harus pilih jawaban dulu
  640.             return redirect(url_for('question28'))
  641.     return render_template("s25.html")
  642.  
  643. @app.route("/Pertanyaan026", methods=["POST", "GET"])
  644. def question26():
  645.     if request.method == 'POST':
  646.         jawaban26 = request.form['qduapuluhenam']
  647.         if jawaban26 == 'Ya' :
  648.             session['qduapuluhenam'] = jawaban26
  649.             return redirect(url_for('question27'))
  650.         elif jawaban26 == 'Pilih Jawaban' :
  651.             session['qduapuluhenam'] = jawaban26
  652.             return redirect(url_for('hasil'))
  653.         else:
  654.             #harus pilih jawaban dulu
  655.             return redirect(url_for('question28'))
  656.     return render_template("s26.html")
  657.  
  658. @app.route("/Pertanyaan027", methods=["POST", "GET"])
  659. def question27():
  660.     if request.method == 'POST':
  661.         jawaban27 = request.form['qduapuluhtujuh']
  662.         if jawaban27 == 'Ya' :
  663.             session['qduapuluhtujuh'] = jawaban27
  664.             return redirect(url_for('hasil9'))
  665.         elif jawaban27 == 'Pilih Jawaban' :
  666.             session['qduapuluhtujuh'] = jawaban27
  667.             return redirect(url_for('hasil'))
  668.         else:
  669.             #harus pilih jawaban dulu
  670.             return redirect(url_for('question28'))
  671.     return render_template("s27.html")
  672.  
  673. @app.route("/Pertanyaan028", methods=["POST", "GET"])
  674. def question28():
  675.     if request.method == 'POST':
  676.         jawaban28 = request.form['qduapuluhdelapan']
  677.         if jawaban28 == 'Ya' :
  678.             session['qduapuluhdelapan'] = jawaban28
  679.             return redirect(url_for('question29'))
  680.         elif jawaban28 == 'Pilih Jawaban' :
  681.             session['qduapuluhdelapan'] = jawaban28
  682.             return redirect(url_for('hasil'))
  683.         else:
  684.             #harus pilih jawaban dulu
  685.             return redirect(url_for('question30'))
  686.     return render_template("s28.html")
  687.  
  688. @app.route("/Pertanyaan029", methods=["POST", "GET"])
  689. def question29():
  690.     if request.method == 'POST':
  691.         jawaban29 = request.form['qduapuluhsembilan']
  692.         if jawaban29 == 'Ya' :
  693.             session['qduapuluhsembilan'] = jawaban29
  694.             return redirect(url_for('hasil10'))
  695.         elif jawaban29 == 'Pilih Jawaban' :
  696.             session['qduapuluhsembilan'] = jawaban29
  697.             return redirect(url_for('hasil'))
  698.         else:
  699.             #harus pilih jawaban dulu
  700.             return redirect(url_for('question30'))
  701.     return render_template("s29.html")
  702.  
  703. @app.route("/Pertanyaan030", methods=["POST", "GET"])
  704. def question30():
  705.     if request.method == 'POST':
  706.         jawaban30 = request.form['qtigapuluh']
  707.         if jawaban30 == 'Ya' :
  708.             session['qtigapuluh'] = jawaban30
  709.             return redirect(url_for('question31'))
  710.         elif jawaban30 == 'Pilih Jawaban' :
  711.             session['qtigapuluh'] = jawaban30
  712.             return redirect(url_for('hasil'))
  713.         else:
  714.             #harus pilih jawaban dulu
  715.             return redirect(url_for('question32'))
  716.     return render_template("s30.html")
  717.  
  718. @app.route("/Pertanyaan031", methods=["POST", "GET"])
  719. def question31():
  720.     if request.method == 'POST':
  721.         jawaban31 = request.form['qtigapuluhsatu']
  722.         if jawaban31 == 'Ya' :
  723.             session['qtigapuluhsatu'] = jawaban31
  724.             return redirect(url_for('hasil11'))
  725.         elif jawaban31 == 'Pilih Jawaban' :
  726.             session['qtigapuluhsatu'] = jawaban31
  727.             return redirect(url_for('hasil'))
  728.         else:
  729.             #harus pilih jawaban dulu
  730.             return redirect(url_for('question32'))
  731.     return render_template("s31.html")
  732.  
  733. @app.route("/Pertanyaan032", methods=["POST", "GET"])
  734. def question32():
  735.     if request.method == 'POST':
  736.         jawaban32 = request.form['qtigapuluhdua']
  737.         if jawaban32 == 'Ya' :
  738.             session['qtigapuluhdua'] = jawaban32
  739.             return redirect(url_for('question34'))
  740.         elif jawaban32 == 'Pilih Jawaban' :
  741.             session['qtigapuluhdua'] = jawaban32
  742.             return redirect(url_for('hasil'))
  743.         else:
  744.             #harus pilih jawaban dulu
  745.             return redirect(url_for('question33'))
  746.     return render_template("s32.html")
  747.  
  748. @app.route("/Pertanyaan033", methods=["POST", "GET"])
  749. def question33():
  750.     if request.method == 'POST':
  751.         jawaban33 = request.form['qtigapuluhtiga']
  752.         if jawaban33 == 'Ya' :
  753.             session['qtigapuluhtiga'] = jawaban33
  754.             return redirect(url_for('hasil12'))
  755.         elif jawaban33 == 'Pilih Jawaban' :
  756.             session['qtigapuluhtiga'] = jawaban33
  757.             return redirect(url_for('hasil'))
  758.         else:
  759.             #harus pilih jawaban dulu
  760.             return redirect(url_for('question34'))
  761.     return render_template("s33.html")
  762.  
  763. @app.route("/Pertanyaan034", methods=["POST", "GET"])
  764. def question34():
  765.     if request.method == 'POST':
  766.         jawaban34 = request.form['qtigapuluhempat']
  767.         if jawaban34 == 'Ya' :
  768.             session['qtigapuluhempat'] = jawaban34
  769.             return redirect(url_for('hasil12'))
  770.         elif jawaban34 == 'Pilih Jawaban' :
  771.             session['qtigapuluhempat'] = jawaban34
  772.             return redirect(url_for('hasil'))
  773.         else:
  774.             #harus pilih jawaban dulu
  775.             return redirect(url_for('hasilbaru'))
  776.     return render_template("s34.html")
  777.  
  778.  
  779. if __name__ == "__main__":
  780.     app.run(debug=True)
  781.  
  782.  
  783.  
Add Comment
Please, Sign In to add comment