This commit is contained in:
Ross
2021-09-09 12:17:02 +01:00
parent 35d9d45b89
commit db5169bfce
2 changed files with 28 additions and 1 deletions
+1 -1
View File
@@ -34,7 +34,7 @@
<tr>
<td><a href="{% url 'cid_scores' user %}">{{user}}</a></td>
<td>{{user_scores|get_item:user}}</td>
<td>{{value}}</td>
<td>{{user_scores_normalised|get_item:user}}</td>
</tr>
{% endfor %}
</table>
+27
View File
@@ -849,11 +849,37 @@ 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 = {}
user_scores_normalised = {}
for user in user_answers_marks:
user_scores[user] = sum(
[i for i in user_answers_marks[user] if i != "unmarked"]
)
user_scores_normalised[user] = normaliseScore(sum(
[i for i in user_answers_marks[user] if i != "unmarked"]
))
user_scores_list = list(user_scores.values())
@@ -895,6 +921,7 @@ def exam_scores_cid(request, pk):
"user_answers": dict(user_answers),
"user_answers_marks": dict(user_answers_marks),
"user_scores": user_scores,
"user_scores_normalised": user_scores_normalised,
"user_scores_list": user_scores_list,
"user_names": user_names,
"user_answers_and_marks": user_answers_and_marks,