Spaces:
Sleeping
Sleeping
fixed submit answers
Browse files
agentcourse_unit4/api/submit_answers_response.py
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
|
|
| 1 |
class SubmitAnswersResponse:
|
| 2 |
def __init__(self, username: str, score: int, correct_count: int, total_attempted: int, message: str, timestamp: str):
|
| 3 |
self.username = username
|
|
@@ -9,10 +10,10 @@ class SubmitAnswersResponse:
|
|
| 9 |
|
| 10 |
def to_submit_answers_response(json_data) -> SubmitAnswersResponse:
|
| 11 |
return SubmitAnswersResponse(
|
| 12 |
-
username=json_data['username']
|
| 13 |
-
score=json_data['score']
|
| 14 |
-
correct_count=json_data['correct_count']
|
| 15 |
-
total_attempted=json_data['total_attempted']
|
| 16 |
-
message=json_data['message']
|
| 17 |
-
timestamp=json_data['timestamp']
|
| 18 |
)
|
|
|
|
| 1 |
+
|
| 2 |
class SubmitAnswersResponse:
|
| 3 |
def __init__(self, username: str, score: int, correct_count: int, total_attempted: int, message: str, timestamp: str):
|
| 4 |
self.username = username
|
|
|
|
| 10 |
|
| 11 |
def to_submit_answers_response(json_data) -> SubmitAnswersResponse:
|
| 12 |
return SubmitAnswersResponse(
|
| 13 |
+
username=json_data['username'] or '<unknown>',
|
| 14 |
+
score=json_data['score'] or 0,
|
| 15 |
+
correct_count=json_data['correct_count'] or 0,
|
| 16 |
+
total_attempted=json_data['total_attempted'] or 0,
|
| 17 |
+
message=json_data['message'] or 'No message received.',
|
| 18 |
+
timestamp=json_data['timestamp'] or '<unknown>'
|
| 19 |
)
|