add sortable candidade score tables

This commit is contained in:
Ross
2024-01-08 14:16:23 +00:00
parent f839ca4ed5
commit 05e551d8e7
4 changed files with 502 additions and 6 deletions
@@ -39,16 +39,17 @@
</div>
<div id="stats-plot">{{plot|safe}}</div>
<div id="stats-block">
<div id="stats-block" title="low scores (<20% max) are excluded from statistics">
<h3>Stats</h3>
Candidates: {{cids|length}}<br />
Questions: <span id="question-number">{{question_number}}</span><br />
Available marks: {{max_score}}<br />
Mean: {{mean}}, Median {{median}}, Mode {{mode}}
Mean: {{mean}}, Median {{median}}, Mode {{mode}}<br />
Top score: {{exam.stats_max}}
</div>
<div>
<table class="table table-dark table-striped table-hover table-sm cid-score-table">
<table class="table table-dark table-striped table-hover table-sm cid-score-table sortable">
<tr>
<th>Candidate ID</th>
<th>Score</th>
+2 -3
View File
@@ -2133,9 +2133,8 @@ class ExamViews(View, LoginRequiredMixin):
lower_score_bound = max_score / 5
bounded_scores = [i for i in user_scores_list if i > lower_score_bound]
if bounded_scores:
mean = statistics.mean(bounded_scores)
else:
mean = statistics.mean(user_scores_list)
user_Scores_list = bounded_scores
mean = statistics.mean(user_scores_list)
median = statistics.median(user_scores_list)
try:
mode = statistics.mode(user_scores_list)