Baptiste Gaultier
commited on
Commit
·
9da45a5
1
Parent(s):
190dc6a
Deal with missing instructions
Browse files
app.py
CHANGED
@@ -22,8 +22,13 @@ def respond(
|
|
22 |
activity_id = request.query_params.get("activity")
|
23 |
|
24 |
if activity_id:
|
25 |
-
|
26 |
-
instructions
|
|
|
|
|
|
|
|
|
|
|
27 |
|
28 |
if activity_id and student_code:
|
29 |
with open(f'instructions/{activity_id}.txt', 'r') as file:
|
|
|
22 |
activity_id = request.query_params.get("activity")
|
23 |
|
24 |
if activity_id:
|
25 |
+
try:
|
26 |
+
with open(f'instructions/{activity_id}.txt', 'r') as file:
|
27 |
+
instructions = file.read()
|
28 |
+
except FileNotFoundError:
|
29 |
+
message = "Tu dois indiquer à l'apprenant que cet exercice n'est pas connu dans la base de données et qu'il doit demander à Baptiste de l'ajouter sur le forum"
|
30 |
+
activity_id = None
|
31 |
+
|
32 |
|
33 |
if activity_id and student_code:
|
34 |
with open(f'instructions/{activity_id}.txt', 'r') as file:
|