.
This commit is contained in:
@@ -280,6 +280,7 @@ def generic_view_urls(generic_views: GenericViewBase):
|
||||
generic_views.question_review,
|
||||
name="question_review",
|
||||
),
|
||||
path("help", generic_views.help, name="help"),
|
||||
]
|
||||
|
||||
return urlpatterns
|
||||
|
||||
@@ -2609,6 +2609,9 @@ class GenericViewBase:
|
||||
|
||||
self.checker_group = g[app_name]
|
||||
|
||||
def help(self, request):
|
||||
return render(request, f"{self.app_name}/help.html", {"app_name": self.app_name})
|
||||
|
||||
def question_review(self, request, pk):
|
||||
"""
|
||||
Return a json representation of the question when the exam is published
|
||||
|
||||
+4
-20
@@ -88,26 +88,6 @@ class Question(QuestionBase):
|
||||
def get_image_url_array(self):
|
||||
return json.dumps([f"{REMOTE_URL}{i.url}" for i in self.get_images()])
|
||||
|
||||
# def GetNonFeedbackQuestionImages(self):
|
||||
# return self.get_images()
|
||||
|
||||
#def get_image_annotations(self):
|
||||
# return json.dumps(
|
||||
# [i.image_annotations for i in self.images.all() if not i.feedback_image]
|
||||
# )
|
||||
|
||||
def get_laterality_string(self):
|
||||
if self.laterality == self.NONE:
|
||||
s = ""
|
||||
elif self.laterality == self.BILATERAL:
|
||||
s = "bilateral "
|
||||
elif self.laterality == self.RIGHT:
|
||||
s = "right "
|
||||
elif self.laterality == self.LEFT:
|
||||
s = "left "
|
||||
|
||||
return s
|
||||
|
||||
def anonymise_images(self):
|
||||
anonymizer = dicognito.anonymizer.Anonymizer()
|
||||
|
||||
@@ -133,6 +113,10 @@ class Question(QuestionBase):
|
||||
|
||||
return False
|
||||
|
||||
def get_best_sample_answer(self):
|
||||
return self.sample_answers.filter(score__gt=0).order_by("-score").first()
|
||||
|
||||
|
||||
|
||||
class QuestionImage(models.Model):
|
||||
question = models.ForeignKey(
|
||||
|
||||
+2
-3
@@ -41,8 +41,7 @@ class QuestionTable(tables.Table):
|
||||
class Meta:
|
||||
model = Question
|
||||
template_name = "django_tables2/bootstrap4.html"
|
||||
fields = ("normal", "abnormality", "region", "examination",
|
||||
"laterality",
|
||||
fields = ("normal", "examination",
|
||||
#"site",
|
||||
"created_date", "open_access", "author")
|
||||
sequence = ("view", "images", "exams")
|
||||
@@ -51,7 +50,7 @@ class QuestionTable(tables.Table):
|
||||
def __init__(self, data=None, *args, **kwargs):
|
||||
super().__init__(
|
||||
data.prefetch_related(
|
||||
"abnormality", "region", "examination", "images", "exams", "author"
|
||||
"examination", "images", "exams", "author"
|
||||
),
|
||||
*args,
|
||||
**kwargs,
|
||||
|
||||
@@ -46,6 +46,9 @@
|
||||
<a class="nav-link" href="{% url 'shorts:user_answer_table_view' %}" title="User answers">Answers</a>
|
||||
</li>
|
||||
{% endif %}
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="{% url 'shorts:help' %}" title="Help Pages">Help</a>
|
||||
</li>
|
||||
{% endif %}
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
@@ -26,13 +26,15 @@
|
||||
</a>
|
||||
</span>
|
||||
<span class="flex-col-4">
|
||||
{% if not question.normal %}
|
||||
<b>Abnormality:</b> {{ question.get_abnormalities }} <b>Region:</b> {{ question.get_regions }}
|
||||
<br />
|
||||
{{ question.get_primary_answer }}
|
||||
|
||||
{% if question.get_best_sample_answer %}
|
||||
{{ question.get_best_sample_answer }}
|
||||
|
||||
{% else %}
|
||||
<b>Normal</b>
|
||||
No sample answer available.
|
||||
|
||||
{% endif %}
|
||||
|
||||
<br />
|
||||
Examination: {{ question.get_examinations }},
|
||||
{% if exam.exam_mode %}
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
{% extends 'shorts/base.html' %}
|
||||
|
||||
|
||||
{% block content %}
|
||||
<h2>Shorts: Help</h2>
|
||||
|
||||
{% endblock content %}
|
||||
|
||||
Reference in New Issue
Block a user