.
This commit is contained in:
@@ -21,6 +21,7 @@
|
||||
{% endfor %}
|
||||
</ul>
|
||||
<br /> Total mark: {{ total_score }} / {{max_score}}
|
||||
<br /> Normalised score: {{ normalised_score }}
|
||||
<div>
|
||||
<a href="{% url 'cid_scores' cid %}">Other exams</a>
|
||||
</div>
|
||||
|
||||
+24
-21
@@ -86,6 +86,26 @@ from generic.mixins import SuperuserRequiredMixin
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
def normaliseScore(score):
|
||||
if score == 49:
|
||||
return 4.5
|
||||
elif score in [50, 51]:
|
||||
return 5
|
||||
elif score in [52, 53]:
|
||||
return 5.5
|
||||
elif score in [54]:
|
||||
return 6
|
||||
elif score in [55, 56]:
|
||||
return 6.5
|
||||
elif score in [57, 58]:
|
||||
return 7
|
||||
elif score in [59]:
|
||||
return 7.5
|
||||
elif score in [60]:
|
||||
return 7.5
|
||||
|
||||
return 4
|
||||
|
||||
class AuthorOrCheckerRequiredMixin(object):
|
||||
def get_object(self, *args, **kwargs):
|
||||
obj = super().get_object(*args, **kwargs)
|
||||
@@ -849,26 +869,6 @@ def exam_scores_cid(request, pk):
|
||||
|
||||
by_question[q].append((ans, answer_score))
|
||||
|
||||
def normaliseScore(score):
|
||||
if score == 49:
|
||||
return 4.5
|
||||
elif score in [50, 51]:
|
||||
return 5
|
||||
elif score in [52, 53]:
|
||||
return 5.5
|
||||
elif score in [54]:
|
||||
return 6
|
||||
elif score in [55, 56]:
|
||||
return 6.5
|
||||
elif score in [57, 58]:
|
||||
return 7
|
||||
elif score in [59]:
|
||||
return 7.5
|
||||
elif score in [60]:
|
||||
return 7.5
|
||||
|
||||
return 4
|
||||
|
||||
|
||||
|
||||
user_scores = {}
|
||||
@@ -980,7 +980,9 @@ def exam_scores_cid_user(request, pk, cid):
|
||||
else:
|
||||
total_score = sum(answers_marks)
|
||||
|
||||
max_score = len(questions)
|
||||
normalised_score = normaliseScore(total_score)
|
||||
|
||||
max_score = len(questions) * 2
|
||||
|
||||
return render(
|
||||
request,
|
||||
@@ -992,6 +994,7 @@ def exam_scores_cid_user(request, pk, cid):
|
||||
"answers": answers,
|
||||
"answers_marks": answers_marks,
|
||||
"total_score": total_score,
|
||||
"normalised_score": normalised_score,
|
||||
"max_score": max_score,
|
||||
"answers_and_marks": answers_and_marks,
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user