improve user score pages
This commit is contained in:
@@ -281,3 +281,23 @@ img.uploading:hover {
|
|||||||
#annotation-json-content {
|
#annotation-json-content {
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.user-answer-score-0 {
|
||||||
|
color: red;
|
||||||
|
}
|
||||||
|
|
||||||
|
.user-answer-score-1 {
|
||||||
|
color: greenyellow;
|
||||||
|
}
|
||||||
|
|
||||||
|
.user-answer-score-2 {
|
||||||
|
color: green;
|
||||||
|
}
|
||||||
|
|
||||||
|
.correct-answer {
|
||||||
|
color: white;
|
||||||
|
}
|
||||||
|
|
||||||
|
.user-answer-li {
|
||||||
|
padding-top: 10px;
|
||||||
|
}
|
||||||
@@ -39,9 +39,11 @@
|
|||||||
{% endif %}
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
<div class="content container">
|
<div class="content container">
|
||||||
|
{% if request.user.is_authenticated %}
|
||||||
<a href="{% url 'anatomy:exam_list' %}">Exams</a> /
|
<a href="{% url 'anatomy:exam_list' %}">Exams</a> /
|
||||||
<a href="{% url 'anatomy:anatomy_question_view' %}">Questions</a> /
|
<a href="{% url 'anatomy:anatomy_question_view' %}">Questions</a> /
|
||||||
<a href="{% url 'anatomy:anatomy_question_create' %}" title="Create a new question">Create Question</a>
|
<a href="{% url 'anatomy:anatomy_question_create' %}" title="Create a new question">Create Question</a>
|
||||||
|
{% endif %}
|
||||||
{% block navigation %}
|
{% block navigation %}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
<div class="row">
|
<div class="row">
|
||||||
|
|||||||
@@ -0,0 +1,18 @@
|
|||||||
|
{% extends 'anatomy/base.html' %}
|
||||||
|
|
||||||
|
{% block content %}
|
||||||
|
<div class="anatomy">
|
||||||
|
<h2>Please enter your CID</h2>
|
||||||
|
<p>CID: <input type="text" name="cid" id="cid-input"></p>
|
||||||
|
<button id="cid-selector-go-button">Go...</button>
|
||||||
|
</div>
|
||||||
|
<script>
|
||||||
|
$(document).ready(function () {
|
||||||
|
|
||||||
|
$("#cid-selector-go-button").click(() => {
|
||||||
|
cid = document.getElementById("cid-input").value;
|
||||||
|
window.location = window.location + cid;
|
||||||
|
})
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
{% endblock %}
|
||||||
@@ -6,10 +6,13 @@
|
|||||||
<h3>Candidate: {{ cid }}</h3>
|
<h3>Candidate: {{ cid }}</h3>
|
||||||
Answers:
|
Answers:
|
||||||
<ul>{% for ans, score, correct_answer in answers_and_marks %}
|
<ul>{% for ans, score, correct_answer in answers_and_marks %}
|
||||||
<li>Question {{forloop.counter}}: {{ correct_answer }}</li>
|
<li class="user-answer-li">Question {{forloop.counter}} - Correct answer: <span class="correct-answer">{{ correct_answer }}</span></li>
|
||||||
{{ans}} ({{score}}),
|
<span class="user-answer-score-{{score}}">{{ans}} ({{score}})</span>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</ul>
|
</ul>
|
||||||
<br /> Total mark: {{ total_score }}
|
<br /> Total mark: {{ total_score }} / {{max_score}}
|
||||||
|
<div>
|
||||||
|
<a href="{% url 'anatomy:cid_scores' cid %}">Other exams</a>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
+2
-1
@@ -28,7 +28,8 @@ urlpatterns = [
|
|||||||
path("exam/json/", views.active_exams, name="active_exams"),
|
path("exam/json/", views.active_exams, name="active_exams"),
|
||||||
path("exam/json/<int:pk>", views.exam_json, name="exam_json"),
|
path("exam/json/<int:pk>", views.exam_json, name="exam_json"),
|
||||||
path("exam/json/<int:pk>/recreate", views.exam_json_recreate, name="exam_json_recreate"),
|
path("exam/json/<int:pk>/recreate", views.exam_json_recreate, name="exam_json_recreate"),
|
||||||
path("cid/<int:pk>/scores", views.cid_scores, name="cid_scores"),
|
path("cid/<int:pk>", views.cid_scores, name="cid_scores"),
|
||||||
|
path("cid/", views.cid_selector, name="cid_selector"),
|
||||||
path("ajax/exam/flag/", views.flag_question, name="flag_question"),
|
path("ajax/exam/flag/", views.flag_question, name="flag_question"),
|
||||||
path("body_part/create/", views.create_body_part, name="create_body_part"),
|
path("body_part/create/", views.create_body_part, name="create_body_part"),
|
||||||
path("body_part/ajax/get_body_part_id",
|
path("body_part/ajax/get_body_part_id",
|
||||||
|
|||||||
+11
-4
@@ -656,8 +656,9 @@ def exam_scores_cid_user(request, pk, sk):
|
|||||||
# skip if no answer
|
# skip if no answer
|
||||||
answers_marks.append(0)
|
answers_marks.append(0)
|
||||||
answers.append("")
|
answers.append("")
|
||||||
continue
|
answer_score = 0
|
||||||
|
ans = "Not answered"
|
||||||
|
else:
|
||||||
ans = user_answer.answer
|
ans = user_answer.answer
|
||||||
|
|
||||||
answer_score = user_answer.get_answer_score()
|
answer_score = user_answer.get_answer_score()
|
||||||
@@ -669,7 +670,7 @@ def exam_scores_cid_user(request, pk, sk):
|
|||||||
|
|
||||||
total_score = sum(answers_marks)
|
total_score = sum(answers_marks)
|
||||||
|
|
||||||
total = len(questions)
|
max_score = len(questions) * 2
|
||||||
|
|
||||||
return render(
|
return render(
|
||||||
request,
|
request,
|
||||||
@@ -681,10 +682,16 @@ def exam_scores_cid_user(request, pk, sk):
|
|||||||
"answers": answers,
|
"answers": answers,
|
||||||
"answers_marks": answers_marks,
|
"answers_marks": answers_marks,
|
||||||
"total_score": total_score,
|
"total_score": total_score,
|
||||||
|
"max_score": max_score,
|
||||||
"answers_and_marks": answers_and_marks,
|
"answers_and_marks": answers_and_marks,
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
|
||||||
|
def cid_selector(request):
|
||||||
|
return render(
|
||||||
|
request,
|
||||||
|
"anatomy/cid_selector.html",
|
||||||
|
)
|
||||||
|
|
||||||
@login_required
|
@login_required
|
||||||
def exam_scores(request, pk):
|
def exam_scores(request, pk):
|
||||||
@@ -748,7 +755,7 @@ def cid_scores(request, pk):
|
|||||||
|
|
||||||
|
|
||||||
if not answers:
|
if not answers:
|
||||||
return Http404("cid not found")
|
raise Http404("cid not found")
|
||||||
|
|
||||||
exam_ids = answers.values_list("exam").distinct()
|
exam_ids = answers.values_list("exam").distinct()
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user