mrpe24 commited on
Commit
a000469
·
1 Parent(s): da43440

fixed submit response

Browse files
agentcourse_unit4/api/submit_answers_response.py CHANGED
@@ -1,6 +1,6 @@
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
5
  self.score = score
6
  self.correct_count = correct_count
@@ -9,9 +9,10 @@ class SubmitAnswersResponse:
9
  self.timestamp = timestamp
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.',
 
1
 
2
  class SubmitAnswersResponse:
3
+ def __init__(self, username: str, score: float, correct_count: int, total_attempted: int, message: str, timestamp: str):
4
  self.username = username
5
  self.score = score
6
  self.correct_count = correct_count
 
9
  self.timestamp = timestamp
10
 
11
  def to_submit_answers_response(json_data) -> SubmitAnswersResponse:
12
+ print(f"Original Response:\n {json_data}")
13
  return SubmitAnswersResponse(
14
  username=json_data['username'] or '<unknown>',
15
+ score=json_data['score'] or 0.0,
16
  correct_count=json_data['correct_count'] or 0,
17
  total_attempted=json_data['total_attempted'] or 0,
18
  message=json_data['message'] or 'No message received.',