This commit is contained in:
Ross
2022-06-26 19:19:35 +01:00
parent f454d5a08d
commit 1da7a8f2bb
2 changed files with 8 additions and 9 deletions
+4 -5
View File
@@ -1504,9 +1504,10 @@ class ExamViews(View, LoginRequiredMixin):
for cid_user_answer in cid_user_answers: for cid_user_answer in cid_user_answers:
# Convoluted (probably...) # Convoluted (probably...)
if cid_user_answer.user is None: if cid_user_answer.user is None:
cid = cid_user_answer.cid cid = f"c/{cid_user_answer.cid}"
cids_user_id_map[cid] = cid
# cid_passcodes[cid] = cid_user_answer.passcode # cid_passcodes[cid] = cid_user_answer.passcode
cids.add("c/"+cid) cids.add(cid)
else: else:
cid = f"u/{cid_user_answer.user.pk}" cid = f"u/{cid_user_answer.user.pk}"
cids_user_id_map[cid] = cid_user_answer.user.username cids_user_id_map[cid] = cid_user_answer.user.username
@@ -1535,11 +1536,8 @@ class ExamViews(View, LoginRequiredMixin):
if self.app_name == "rapids": if self.app_name == "rapids":
callstate = s.get_answer_callstate() callstate = s.get_answer_callstate()
print(cid, callstate)
by_question[q][cid] = (ans, answer_score, callstate) by_question[q][cid] = (ans, answer_score, callstate)
user_answers_callstates[cid].append(callstate) user_answers_callstates[cid].append(callstate)
print(user_answers_callstates)
print("CID:::",cid, user_answers_callstates[cid])
elif self.app_name in ("rapids", "anatomy", "sbas"): elif self.app_name in ("rapids", "anatomy", "sbas"):
by_question[q][cid] = (ans, answer_score) by_question[q][cid] = (ans, answer_score)
else: else:
@@ -1645,6 +1643,7 @@ class ExamViews(View, LoginRequiredMixin):
# "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,
"cids_user_id_map": cids_user_id_map,
"max_score": max_score, "max_score": max_score,
"mean": mean, "mean": mean,
"median": median, "median": median,
+4 -4
View File
@@ -34,9 +34,9 @@
{% for cid in cids %} {% for cid in cids %}
<tr> <tr>
{% if cid|slice:":1" == "u" %} {% if cid|slice:":1" == "u" %}
<td>{{cid}}</td> <td>{{cids_user_id_map|get_item:cid}}</td>
{% else %} {% else %}
<td><a href="{% url 'cid_scores_admin' cid %}">{{cid}}</a></td> <td><a href="{% url 'cid_scores_admin' cid|slice:'2:' %}">{{cid}}</a></td>
{% endif %} {% endif %}
<td>{{user_scores|get_item:cid}}</td> <td>{{user_scores|get_item:cid}}</td>
<td>{{user_scores_normalised|get_item:cid}}</td> <td>{{user_scores_normalised|get_item:cid}}</td>
@@ -52,7 +52,7 @@
<th>Candidate</th> <th>Candidate</th>
{% for cid in cids %} {% for cid in cids %}
{% comment %} <th><a href="{% url 'rapids:exam_scores_cid_user' exam.pk cid %}">{{cid}}</a></th> {% endcomment %} {% comment %} <th><a href="{% url 'rapids:exam_scores_cid_user' exam.pk cid %}">{{cid}}</a></th> {% endcomment %}
<th><a href="">{{cid}}</a></th> <th><a href="">{{cids_user_id_map|get_item:cid}}</a></th>
{% endfor %} {% endfor %}
</tr> </tr>
@@ -85,7 +85,7 @@
<ul> <ul>
{% for user, breakdown in user_answers_callstates.items %} {% for user, breakdown in user_answers_callstates.items %}
<li> <li>
{{user}} - {{breakdown}} {{cids_user_id_map|get_item:user}} - {{breakdown}}
</li> </li>
{% endfor %} {% endfor %}
</ul> </ul>