Max score fixed

This commit is contained in:
Piotr Kopycki 2022-01-25 16:53:48 +01:00
parent b10aec8fc5
commit 553686e2ae
2 changed files with 5 additions and 2 deletions

View File

@ -55,8 +55,10 @@ class Test(models.Model):
]
"""
points = 0
for answer in answers:
question = self.questions.get(id=answer["question"])
# for answer in answers:
# question = self.questions.get(id=answer["question"])
# points += question.points
for question in self.questions.all():
points += question.points
return points

View File

@ -89,6 +89,7 @@ def solvedTests(request):
"name": solved_test.test.name_and_passing_score()["name"],
"passing_score": solved_test.test.name_and_passing_score()["passing_score"],
"score": solved_test.score,
"max": solved_test.max,
"percentage": solved_test.percentage
})
context['tests'] = formatted_tests