.
This commit is contained in:
+5
-5
@@ -407,13 +407,13 @@ class CidUserAnswer(models.Model):
|
|||||||
class ScoreOptions(models.TextChoices):
|
class ScoreOptions(models.TextChoices):
|
||||||
UNMARKED = "", _("Unmarked")
|
UNMARKED = "", _("Unmarked")
|
||||||
FOUR = 4, _("4")
|
FOUR = 4, _("4")
|
||||||
FOUR_HALF = "4.5", _("4.5")
|
FOUR_HALF = 4.5, _("4.5")
|
||||||
FIVE = 5, _("5")
|
FIVE = 5, _("5")
|
||||||
FIVE_HALF = "5.5", _("5.5")
|
FIVE_HALF = 5.5, _("5.5")
|
||||||
SIX = 6, _("6")
|
SIX = 6, _("6")
|
||||||
SIX_HALF = "6.5", _("6.5")
|
SIX_HALF = 6.5, _("6.5")
|
||||||
SEVEN = 7, _("7")
|
SEVEN = 7, _("7")
|
||||||
SEVEN_HALF = "7.5", _("7.5")
|
SEVEN_HALF = 7.5, _("7.5")
|
||||||
EIGHT = 8, _("8")
|
EIGHT = 8, _("8")
|
||||||
|
|
||||||
score = models.CharField(
|
score = models.CharField(
|
||||||
@@ -458,4 +458,4 @@ class CidUserAnswer(models.Model):
|
|||||||
return True
|
return True
|
||||||
|
|
||||||
def get_answer_score(self):
|
def get_answer_score(self):
|
||||||
return self.score
|
return float(self.score)
|
||||||
|
|||||||
+3
-3
@@ -807,7 +807,7 @@ def exam_scores_cid(request, pk):
|
|||||||
user_scores = {}
|
user_scores = {}
|
||||||
for user in user_answers_marks:
|
for user in user_answers_marks:
|
||||||
user_scores[user] = sum(
|
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())
|
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_marks.append(answer_score)
|
||||||
#answers_and_marks.append((ans, answer_score, correct_answer))
|
#answers_and_marks.append((ans, answer_score, correct_answer))
|
||||||
|
|
||||||
|
answered = [i for i in answers_marks if i != ""]
|
||||||
if "" in answers_marks:
|
if "" in answers_marks:
|
||||||
answered = [int(i) for i in answers_marks if i != ""]
|
|
||||||
total_score = sum(answered)
|
total_score = sum(answered)
|
||||||
unmarked_number = len(answers_marks) - len(answered)
|
unmarked_number = len(answers_marks) - len(answered)
|
||||||
total_score = "{} ({} unmarked)".format(total_score, unmarked_number)
|
total_score = "{} ({} unmarked)".format(total_score, unmarked_number)
|
||||||
else:
|
else:
|
||||||
total_score = sum(answers_marks)
|
total_score = sum(answered)
|
||||||
|
|
||||||
max_score = len(questions) * 2
|
max_score = len(questions) * 2
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user