Spaces:
Sleeping
Sleeping
elibrowne
commited on
Commit
·
280d303
1
Parent(s):
46a842f
State?
Browse files
app.py
CHANGED
|
@@ -495,11 +495,11 @@ with gr.Blocks(theme = theme) as user_eval:
|
|
| 495 |
|
| 496 |
def submit_email(email):
|
| 497 |
user_id = email
|
| 498 |
-
|
| 499 |
# After loading user data, update with current question
|
| 500 |
-
|
| 501 |
-
new_answers =
|
| 502 |
-
new_answers[
|
| 503 |
return {
|
| 504 |
question: gr.Row(visible = True),
|
| 505 |
login: gr.Row(visible = False),
|
|
@@ -524,8 +524,8 @@ with gr.Blocks(theme = theme) as user_eval:
|
|
| 524 |
c: gr.Button(current_question["answers"][2]),
|
| 525 |
d: gr.Button(current_question["answers"][3]),
|
| 526 |
user_id: user_id,
|
| 527 |
-
user_data:
|
| 528 |
-
current_question:
|
| 529 |
}
|
| 530 |
s.click(fn = submit_email, inputs = [email], outputs = [question, login, selection, passage_display, q_text, a, b, c, d, user_id, user_data, current_question])
|
| 531 |
|
|
|
|
| 495 |
|
| 496 |
def submit_email(email):
|
| 497 |
user_id = email
|
| 498 |
+
loaded_data = load_user_data(user_id) # calls login, downloads data, initializes session
|
| 499 |
# After loading user data, update with current question
|
| 500 |
+
new_q = load_current_question(loaded_data, user_id)
|
| 501 |
+
new_answers = new_q["answers"].copy()
|
| 502 |
+
new_answers[new_q["correct_answer_index"]] = "**" + new_q["answers"][new_q["correct_answer_index"]] + "** ✅"
|
| 503 |
return {
|
| 504 |
question: gr.Row(visible = True),
|
| 505 |
login: gr.Row(visible = False),
|
|
|
|
| 524 |
c: gr.Button(current_question["answers"][2]),
|
| 525 |
d: gr.Button(current_question["answers"][3]),
|
| 526 |
user_id: user_id,
|
| 527 |
+
user_data: loaded_data,
|
| 528 |
+
current_question: new_q
|
| 529 |
}
|
| 530 |
s.click(fn = submit_email, inputs = [email], outputs = [question, login, selection, passage_display, q_text, a, b, c, d, user_id, user_data, current_question])
|
| 531 |
|