generated from upperlinecode/flaskproject
-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.py
215 lines (158 loc) · 5.73 KB
/
app.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
# ---- YOUR APP STARTS HERE ----
# -- Import section --
from flask import Flask
from flask import render_template
from flask import request
from model import feedback1
from model import feedback2
# -- Initialization section --
app = Flask(__name__)
# -- Routes section --
@app.route('/')
@app.route('/index')
def index():
return render_template('index.html')
@app.route('/languages')
def languages():
return render_template('languages.html')
@app.route('/yoruba-demo')
def yoruba_demo():
return render_template('yoruba-demo.html')
@app.route('/sign-up')
def sign_up():
return render_template('sign-up.html')
@app.route('/log-in')
def log_in():
return render_template('log-in.html')
# --- Lesson 1 ---
@app.route('/yoruba/lesson1/questions')
def lesson1_question1():
return render_template('yoruba-lesson1_copy/questions.html')
# @app.route('/yoruba/lesson1/question2')
# def lesson1_question2():
# return render_template('yoruba-lesson1/q2.html')
# @app.route('/yoruba/lesson1/question3')
# def lesson1_question3():
# return render_template('yoruba-lesson1/q3.html')
# @app.route('/yoruba/lesson1/question4')
# def lesson1_question4():
# return render_template('yoruba-lesson1/q4.html')
# @app.route('/yoruba/lesson1/question5')
# def lesson1_question5():
# return render_template('yoruba-lesson1/q5.html')
# @app.route('/yoruba/lesson1/question6')
# def lesson1_question6():
# return render_template('yoruba-lesson1/q6.html')
# @app.route('/yoruba/lesson1/question7')
# def lesson1_question7():
# return render_template('yoruba-lesson1/q7.html')
# @app.route('/yoruba/lesson1/question8')
# def lesson1_question8():
# return render_template('yoruba-lesson1/q8.html')
# @app.route('/yoruba/lesson1/question9')
# def lesson1_question9():
# return render_template('yoruba-lesson1/q9.html')
# @app.route('/yoruba/lesson1/question10')
# def lesson1_question10():
# return render_template('yoruba-lesson1/q10.html')
@app.route('/yoruba/lesson1/results', methods=['GET', 'POST'])
def lesson1_results():
if request.method == 'GET':
return "You are getting the results page"
if request.method == 'POST':
answer1 = request.form['answer_1']
answer2 = request.form['answer_2']
answer3 = request.form['answer_3']
answer4 = request.form['answer_4']
answer5 = request.form['answer_5']
answer6 = request.form['answer_6']
answer7 = request.form['answer_7']
answer8 = request.form['answer_8']
answer9 = request.form['answer_9']
answer10 = request.form['answer_10']
responses = {
'answer1': answer1,
'answer2': answer2,
'answer3': answer3,
'answer4': answer4,
'answer5': answer5,
'answer6': answer6,
'answer7': answer7,
'answer8': answer8,
'answer9': answer9,
'answer10': answer10
}
results = feedback1(responses)
percentage = results.get('percentage')
message = results.get('message')
props = {
'percentage': percentage,
'message': message
}
return render_template('yoruba-lesson1_copy/results.html', props=props)
# Lesson 2
@app.route('/yoruba/lesson2/questions')
def lesson2_question1():
return render_template('yoruba-lesson2_copy/questions.html')
# @app.route('/yoruba/lesson2/question2')
# def lesson2_question2():
# return render_template('yoruba-lesson2/q2.html')
# @app.route('/yoruba/lesson2/question3')
# def lesson2_question3():
# return render_template('yoruba-lesson2/q3.html')
# @app.route('/yoruba/lesson2/question4')
# def lesson2_question4():
# return render_template('yoruba-lesson2/q4.html')
# @app.route('/yoruba/lesson2/question5')
# def lesson2_question5():
# return render_template('yoruba-lesson2/q5.html')
# @app.route('/yoruba/lesson2/question6')
# def lesson2_question6():
# return render_template('yoruba-lesson2/q6.html')
# @app.route('/yoruba/lesson2/question7')
# def lesson2_question7():
# return render_template('yoruba-lesson2/q7.html')
# @app.route('/yoruba/lesson2/question8')
# def lesson2_question8():
# return render_template('yoruba-lesson2/q8.html')
# @app.route('/yoruba/lesson2/question9')
# def lesson2_question9():
# return render_template('yoruba-lesson2/q9.html')
# @app.route('/yoruba/lesson2/question10')
# def lesson2_question10():
# return render_template('yoruba-lesson2/q10.html')
@app.route('/yoruba/lesson2/results', methods=['GET', 'POST'])
def lesson2_results():
if request.method == 'GET':
return "You are getting the results page"
if request.method == 'POST':
answer1 = request.form['answer_1']
answer2 = request.form['answer_2']
answer3 = request.form['answer_3']
answer4 = request.form['answer_4']
answer5 = request.form['answer_5']
answer6 = request.form['answer_6']
answer7 = request.form['answer_7']
answer8 = request.form['answer_8']
answer9 = request.form['answer_9']
answer10 = request.form['answer_10']
responses = {
'answer1': answer1,
'answer2': answer2,
'answer3': answer3,
'answer4': answer4,
'answer5': answer5,
'answer6': answer6,
'answer7': answer7,
'answer8': answer8,
'answer9': answer9,
'answer10': answer10
}
results = feedback2(responses)
percentage = results.get('percentage')
message = results.get('message')
props = {
'percentage': percentage,
'message': message
}
return render_template('yoruba-lesson2_copy/results.html', props=props)