This commit is contained in:
Ross
2021-12-12 21:28:27 +00:00
parent 4a754213cb
commit 6be1c32720
2 changed files with 72 additions and 44 deletions
+10
View File
@@ -123,6 +123,14 @@ def cid_scores(request, pk, passcode):
sbas_exam_ids = sbas_answers.values_list("exam").distinct() sbas_exam_ids = sbas_answers.values_list("exam").distinct()
sba_exams = SbasExam.objects.filter(id__in=sbas_exam_ids, **kwargs) sba_exams = SbasExam.objects.filter(id__in=sbas_exam_ids, **kwargs)
available_exams = []
exam_types = ("physics_exams", "rapid_exams", "sba_exams", "anatomy_exams", "longs_exams")
for t in exam_types:
exams = getattr(cid_user, t).all()
available_exams.push((t, exams))
return render( return render(
request, request,
"cid_scores.html", "cid_scores.html",
@@ -134,6 +142,8 @@ def cid_scores(request, pk, passcode):
"sba_exams": sba_exams, "sba_exams": sba_exams,
"cid": cid, "cid": cid,
"passcode": passcode, "passcode": passcode,
"cid_user": cid_user,
"available_exams": available_exams,
}, },
) )
+62 -44
View File
@@ -1,48 +1,66 @@
{% extends 'base.html' %} {% extends 'base.html' %}
{% block content %} {% block content %}
<div class=""> <div class="">
<h2>CID: {{ cid }}</h2> <h2>CID: {{ cid }}</h2>
The following exams have been found (click to view answers and scores): <h3>Exams to take</h3>
{% if physics_exams %}
<h3>Physics</h3>
<ul> {% for t, exams in available_exams %}
{% for exam in physics_exams %} {{t}}:
<li><a href="{% url 'physics:exam_scores_cid_user' pk=exam.pk sk=cid passcode=passcode %}">{{exam.name}}</a></li>
{% for e in exams %}
{{e}}
{% endfor %}
{% endfor %} {% endfor %}
</ul>
{% endif %}
{% if anatomy_exams %}
<h3>Anatomy</h3>
<ul> <h3>Taken Exams</h3>
{% for exam in anatomy_exams %} The following exams have been found (click to view answers and scores):
<li><a href="{% url 'anatomy:exam_scores_cid_user' pk=exam.pk sk=cid passcode=passcode %}">{{exam.name}}</a></li> {% if physics_exams %}
{% endfor %} <h3>Physics</h3>
</ul> <ul>
{% endif %} {% for exam in physics_exams %}
{% if rapid_exams %} <li><a href="{% url 'physics:exam_scores_cid_user' pk=exam.pk sk=cid passcode=passcode %}">{{exam.name}}</a></li>
<h3>Rapids</h3> {% endfor %}
<ul> </ul>
{% for exam in rapid_exams %} {% endif %}
<li><a href="{% url 'rapids:exam_scores_cid_user' pk=exam.pk cid=cid passcode=passcode %}">{{exam.name}}</a></li> {% if anatomy_exams %}
{% endfor %} <h3>Anatomy</h3>
</ul> <ul>
{% endif %} {% for exam in anatomy_exams %}
{% if longs_exams %} <li><a href="{% url 'anatomy:exam_scores_cid_user' pk=exam.pk sk=cid passcode=passcode %}">{{exam.name}}</a></li>
<h3>Longs</h3> {% endfor %}
<ul> </ul>
{% for exam in longs_exams %} {% endif %}
<li><a href="{% url 'longs:exam_scores_cid_user' pk=exam.pk sk=cid passcode=passcode %}">{{exam.name}}</a></li> {% if rapid_exams %}
{% endfor %} <h3>Rapids</h3>
</ul> <ul>
{% endif %} {% for exam in rapid_exams %}
{% if sba_exams %} <li><a href="{% url 'rapids:exam_scores_cid_user' pk=exam.pk cid=cid passcode=passcode %}">{{exam.name}}</a></li>
<h3>SBAs</h3> {% endfor %}
<ul> </ul>
{% for exam in sba_exams %} {% endif %}
<li><a href="{% url 'sbas:exam_scores_cid_user' pk=exam.pk sk=cid passcode=passcode %}">{{exam.name}}</a></li> {% if longs_exams %}
{% endfor %} <h3>Longs</h3>
</ul> <ul>
{% endif %} {% for exam in longs_exams %}
</div> <li><a href="{% url 'longs:exam_scores_cid_user' pk=exam.pk sk=cid passcode=passcode %}">{{exam.name}}</a></li>
{% endblock %} {% endfor %}
</ul>
{% endif %}
{% if sba_exams %}
<h3>SBAs</h3>
<ul>
{% for exam in sba_exams %}
<li><a href="{% url 'sbas:exam_scores_cid_user' pk=exam.pk sk=cid passcode=passcode %}">{{exam.name}}</a></li>
{% endfor %}
</ul>
{% endif %}
</div>
{% endblock %}