try to improve the scores pages

This commit is contained in:
Ross
2026-07-06 12:33:30 +01:00
parent 7bd1475daf
commit 50b80fd0c7
12 changed files with 287 additions and 250 deletions
+11 -49
View File
@@ -85,57 +85,19 @@
<div class="d-flex justify-content-between align-items-center mb-1">
<h5 class="mb-0">Answers as a table</h5>
<div>
<button class="btn btn-sm btn-outline-secondary" data-bs-toggle="collapse" data-bs-target="#answers-table" aria-expanded="true">Toggle answers</button>
<button class="btn btn-sm btn-outline-secondary" data-bs-toggle="collapse" data-bs-target="#answers-table-container" aria-expanded="true">Toggle answers</button>
</div>
</div>
<div class="collapse show" id="answers-table">
<div class="table-responsive">
<table class="table table-dark table-striped table-hover table-sm col-sm small">
<thead class="thead-dark">
<tr>
<th>Candidate</th>
{% for cid in cids %}
{% comment %} <th><a href="{% url exam.app_name|add:':exam_scores_cid_user' exam.pk cid %}">{{cid}}</a></th> {% endcomment %}
<th>
{% if cid|slice:":1" == "u" %}
<a href="{% url exam.app_name|add:':exam_scores_user_admin' exam.pk cid|slice:'2:' %}">
{% else %}
<a href="{% url exam.app_name|add:':exam_scores_cid_user_admin' exam.pk cid|slice:'2:' %}">
{% endif %}
{{cids_user_id_map|get_item:cid}}</a></th>
{% endfor %}
</tr>
</thead>
{% block table_answers %}
{% endblock table_answers %}
{% comment %} {% for question in questions %}
<tr>
<td><a href="{% url exam.app_name|add:':mark' exam_pk=exam.pk sk=forloop.counter0 %}">Question {{forloop.counter}}</a>
{% if question.normal %}
[N]
{% else %}
[A]
{% endif %}
</td>
{% for cid in cids %}
{% with by_question|get_item:question|get_item:cid as ans_score %}
<td class="user-answer-score-{{ans_score.1}}" title="answer score: {{ans_score.1}} [{{ans_score.2}}]">{{ans_score.0}}</td>
{% endwith %}
{% endfor %}
</tr>
{% endfor %} {% endcomment %}
<tr>
<td>Score:</td>
{% for cid in cids %}
<td>{{user_scores|get_item:cid}}</td>
{% endfor %}
</tr>
</table>
<div class="collapse show" id="answers-table-container">
<div hx-get="{% url exam.app_name|add:':exam_scores_all' exam.pk %}?table_only=true"
hx-trigger="load"
hx-swap="outerHTML">
<div class="text-center py-4">
<div class="spinner-border text-info" role="status">
<span class="visually-hidden">Loading...</span>
</div>
<div class="text-muted mt-2">Loading answers table...</div>
</div>
</div>
</div>
@@ -0,0 +1,27 @@
<div class="table-responsive" id="answers-table">
<table class="table table-dark table-striped table-hover table-sm col-sm small">
<thead class="thead-dark">
<tr>
<th>Candidate</th>
{% for cid in cids %}
<th>
{% if cid|slice:":1" == "u" %}
<a href="{% url exam.app_name|add:':exam_scores_user_admin' exam.pk cid|slice:'2:' %}">
{% else %}
<a href="{% url exam.app_name|add:':exam_scores_cid_user_admin' exam.pk cid|slice:'2:' %}">
{% endif %}
{{cids_user_id_map|get_item:cid}}</a>
</th>
{% endfor %}
</tr>
</thead>
{% block table_answers %}
{% endblock table_answers %}
<tr>
<td>Score:</td>
{% for cid in cids %}
<td>{{user_scores|get_item:cid}}</td>
{% endfor %}
</tr>
</table>
</div>