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