This commit is contained in:
Ross
2020-12-28 23:45:19 +00:00
parent e5af6c237f
commit ca5d393408
4 changed files with 40 additions and 19 deletions
+3 -3
View File
@@ -21,7 +21,8 @@ a, a:link {
.answer-list .answer:hover{
z-index: 99999;
color:rgba(142, 68, 173, 1);
position: relative;
background: rgba(167, 167, 167, 0.7);
}
.answer-list .correct {
@@ -153,7 +154,6 @@ button a {
#dicom-image {
width: 100%;
height: 600px;
z-index: 0;
}
#dicom-image.marking-dicom {
@@ -162,7 +162,7 @@ button a {
bottom: 0px;
width: 50%;
height: 90%;
z-index: 1;
}
.marking {
+9 -2
View File
@@ -14,10 +14,11 @@
</div>
<div id="stats-block">
<h2>Stats</h2>
<h3>Stats</h3>
Max score: {{max_score}}<br/>
Mean: {{mean}}, Median {{median}}, Mode {{mode}}
<div id="stats-plot"><h3>Distribution of results</h3>{{plot|safe}}</div>
<div id="stats-plot">{{plot|safe}}</div>
</div>
<div>
<table>
@@ -51,6 +52,12 @@
{% endfor %}
</tr>
{% endfor %}
<tr>
<td>Score:</td>
{% for score in user_scores %}
<td>{{score}}</td>
{% endfor %}
<tr>
</table>
</div>
+26 -13
View File
@@ -108,6 +108,7 @@ def question_detail(request, pk):
return render(request, "anatomy/question_detail.html", {"question": question})
@login_required
def exam_question_detail(request, pk, sk):
exam = get_object_or_404(Exam, pk=pk)
@@ -120,12 +121,23 @@ def exam_question_detail(request, pk, sk):
previous = -1
if sk > 0:
previous = sk-1
next = sk+1
if sk == exam_length-1:
previous = sk - 1
next = sk + 1
if sk == exam_length - 1:
next = False
return render(request, "anatomy/question_detail.html", {"question": question, "exam": exam, "next" : next, "previous" : previous, "exam_length" : exam_length, "pos": pos})
return render(
request,
"anatomy/question_detail.html",
{
"question": question,
"exam": exam,
"next": next,
"previous": previous,
"exam_length": exam_length,
"pos": pos,
},
)
@login_required
@@ -685,7 +697,7 @@ def exam_scores_cid(request, pk):
)
fig_html = fig.to_html()
total = len(questions)
max_score = len(questions) * 2
return render(
request,
@@ -698,9 +710,10 @@ def exam_scores_cid(request, pk):
"by_question": by_question,
"user_answers": dict(user_answers),
"user_answers_marks": dict(user_answers_marks),
"user_scores": user_scores,
"user_scores": user_scores_list,
"user_names": user_names,
"user_answers_and_marks": user_answers_and_marks,
"max_score": max_score,
"mean": mean,
"median": median,
"mode": mode,
@@ -894,18 +907,17 @@ class AnatomyQuestionCreateBase(LoginRequiredMixin, CreateView):
return response
# else we redirect to the clone url
else:
return redirect(
"anatomy:question_clone", pk=self.object.pk
)
return redirect("anatomy:question_clone", pk=self.object.pk)
else:
return super().form_invalid(form)
@login_required
def question_clone(request, pk):
new_item = get_object_or_404(AnatomyQuestion, pk=pk)
new_item.pk = None #autogen a new pk (item_id)
#new_item.name = "Copy of " + new_item.name #need to change uniques
new_item.pk = None # autogen a new pk (item_id)
# new_item.name = "Copy of " + new_item.name #need to change uniques
form = AnatomyQuestion(request.POST or None, instance=new_item)
@@ -914,7 +926,7 @@ def question_clone(request, pk):
if form.is_valid():
form.instance.author.add(request.user.id)
#logger.debug(formset.is_valid())
# logger.debug(formset.is_valid())
if formset.is_valid():
response = super().form_valid(form)
formset.instance = obj
@@ -926,7 +938,7 @@ def question_clone(request, pk):
context = {
"form": form,
"answer_formset": formset
#other context
# other context
}
return render(request, "anatomy/anatomyquestion_form.html", context)
@@ -998,6 +1010,7 @@ class AnatomyQuestionUpdate(LoginRequiredMixin, UpdateView):
class QuestionClone(AnatomyQuestionCreateBase):
"""Clones a existing rapid"""
# fields = '__all__'
# #fields = [ 'condition' ]
# #initial = {'date_of_death': '05/01/2018'}
+2 -1
View File
@@ -3,9 +3,10 @@
<head>
<title>Penra Courses</title>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css" />
<link rel="stylesheet" href="{% static 'css/anatomy.css' %}">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"> </script>
<script type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"> </script>
</head>