.
This commit is contained in:
@@ -34,7 +34,7 @@
|
|||||||
<tr>
|
<tr>
|
||||||
<td><a href="{% url 'cid_scores' user %}">{{user}}</a></td>
|
<td><a href="{% url 'cid_scores' user %}">{{user}}</a></td>
|
||||||
<td>{{user_scores|get_item:user}}</td>
|
<td>{{user_scores|get_item:user}}</td>
|
||||||
<td>{{value}}</td>
|
<td>{{user_scores_normalised|get_item:user}}</td>
|
||||||
</tr>
|
</tr>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</table>
|
</table>
|
||||||
|
|||||||
@@ -849,11 +849,37 @@ def exam_scores_cid(request, pk):
|
|||||||
|
|
||||||
by_question[q].append((ans, answer_score))
|
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 = {}
|
||||||
|
user_scores_normalised = {}
|
||||||
for user in user_answers_marks:
|
for user in user_answers_marks:
|
||||||
user_scores[user] = sum(
|
user_scores[user] = sum(
|
||||||
[i for i in user_answers_marks[user] if i != "unmarked"]
|
[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())
|
user_scores_list = list(user_scores.values())
|
||||||
|
|
||||||
@@ -895,6 +921,7 @@ def exam_scores_cid(request, pk):
|
|||||||
"user_answers": dict(user_answers),
|
"user_answers": dict(user_answers),
|
||||||
"user_answers_marks": dict(user_answers_marks),
|
"user_answers_marks": dict(user_answers_marks),
|
||||||
"user_scores": user_scores,
|
"user_scores": user_scores,
|
||||||
|
"user_scores_normalised": user_scores_normalised,
|
||||||
"user_scores_list": user_scores_list,
|
"user_scores_list": user_scores_list,
|
||||||
"user_names": user_names,
|
"user_names": user_names,
|
||||||
"user_answers_and_marks": user_answers_and_marks,
|
"user_answers_and_marks": user_answers_and_marks,
|
||||||
|
|||||||
Reference in New Issue
Block a user