This commit is contained in:
Ross
2021-02-17 14:33:22 +00:00
parent 67ad358f2b
commit 7e3c9bf933
2 changed files with 8 additions and 8 deletions
+5 -5
View File
@@ -407,13 +407,13 @@ class CidUserAnswer(models.Model):
class ScoreOptions(models.TextChoices):
UNMARKED = "", _("Unmarked")
FOUR = 4, _("4")
FOUR_HALF = "4.5", _("4.5")
FOUR_HALF = 4.5, _("4.5")
FIVE = 5, _("5")
FIVE_HALF = "5.5", _("5.5")
FIVE_HALF = 5.5, _("5.5")
SIX = 6, _("6")
SIX_HALF = "6.5", _("6.5")
SIX_HALF = 6.5, _("6.5")
SEVEN = 7, _("7")
SEVEN_HALF = "7.5", _("7.5")
SEVEN_HALF = 7.5, _("7.5")
EIGHT = 8, _("8")
score = models.CharField(
@@ -458,4 +458,4 @@ class CidUserAnswer(models.Model):
return True
def get_answer_score(self):
return self.score
return float(self.score)
+3 -3
View File
@@ -807,7 +807,7 @@ def exam_scores_cid(request, pk):
user_scores = {}
for user in user_answers_marks:
user_scores[user] = sum(
[float(i) for i in user_answers_marks[user] if i != ""]
[i for i in user_answers_marks[user] if i != ""]
)
user_scores_list = list(user_scores.values())
@@ -894,13 +894,13 @@ def exam_scores_cid_user(request, pk, sk):
answers_marks.append(answer_score)
#answers_and_marks.append((ans, answer_score, correct_answer))
answered = [i for i in answers_marks if i != ""]
if "" in answers_marks:
answered = [int(i) for i in answers_marks if i != ""]
total_score = sum(answered)
unmarked_number = len(answers_marks) - len(answered)
total_score = "{} ({} unmarked)".format(total_score, unmarked_number)
else:
total_score = sum(answers_marks)
total_score = sum(answered)
max_score = len(questions) * 2