Change constructor of score. Create new function to add score value from a string.

This commit is contained in:
alwayscompiling
2022-08-06 17:32:17 -04:00
parent b80f160914
commit b5959ccc33
3 changed files with 35 additions and 8 deletions
+6 -2
View File
@@ -46,9 +46,13 @@ class Category:
category.time_record = data["time_record"]
for user, score in data["scores"].items():
if category.time_record:
category.add_score(ScoreTime(user, score))
score_obj: ScoreTime = ScoreTime(user)
score_obj.value = float(score)
category.add_score(score_obj)
else:
category.add_score(Score(user, score))
score_obj: Score = Score(user)
score_obj.value = int(score)
category.add_score(score_obj)
return category