start adding self review to collections
This commit is contained in:
@@ -0,0 +1,18 @@
|
||||
# Generated by Django 4.1.4 on 2023-07-03 12:52
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('atlas', '0003_alter_series_modality'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AddField(
|
||||
model_name='casecollection',
|
||||
name='self_review',
|
||||
field=models.BooleanField(default=False, help_text='If true allows users self complete and review cases in a self directed way.'),
|
||||
),
|
||||
]
|
||||
+9
-6
@@ -329,7 +329,6 @@ class SeriesImage(SeriesImageBase):
|
||||
)
|
||||
|
||||
|
||||
|
||||
class SeriesFinding(models.Model):
|
||||
series = models.ForeignKey(
|
||||
"Series", related_name="findings", on_delete=models.SET_NULL, null=True
|
||||
@@ -400,13 +399,13 @@ class Series(SeriesBase):
|
||||
self.pk, self.get_examination_full(), self.description, case_id
|
||||
)
|
||||
|
||||
|
||||
def get_absolute_url(self):
|
||||
return reverse("atlas:series_detail", kwargs={"pk": self.pk})
|
||||
|
||||
def get_link(self):
|
||||
return format_html("<a href='{}'>{}</a>", self.get_absolute_url(), self.get_full_str())
|
||||
|
||||
return format_html(
|
||||
"<a href='{}'>{}</a>", self.get_absolute_url(), self.get_full_str()
|
||||
)
|
||||
|
||||
|
||||
class CaseCollection(ExamCollectionGenericBase):
|
||||
@@ -476,6 +475,12 @@ class CaseCollection(ExamCollectionGenericBase):
|
||||
archive = models.BooleanField(default=False)
|
||||
exam_mode = models.BooleanField(default=False)
|
||||
|
||||
# This should override the publish setting
|
||||
self_review = models.BooleanField(
|
||||
default=False,
|
||||
help_text="If true allows users self complete and review cases in a self directed way.",
|
||||
)
|
||||
|
||||
open_access = models.BooleanField(
|
||||
help_text="If the exam is freely accessible (to view and edit on the test system)",
|
||||
default=False,
|
||||
@@ -550,8 +555,6 @@ class BaseReportAnswer(models.Model):
|
||||
else:
|
||||
raise ValueError("No cid or user specified")
|
||||
|
||||
|
||||
|
||||
class Meta:
|
||||
abstract = True
|
||||
|
||||
|
||||
@@ -31,6 +31,8 @@
|
||||
|
||||
Start time: {{cid_user_exam.start_time}}
|
||||
|
||||
<p>Completed: {{cid_user_exam.completed}}</p>
|
||||
|
||||
{% endblock %}
|
||||
|
||||
{% block js %}
|
||||
|
||||
+9
-5
@@ -1255,7 +1255,7 @@ def collection_take_overview(
|
||||
):
|
||||
collection = get_object_or_404(CaseCollection, pk=pk)
|
||||
|
||||
if not collection.active:
|
||||
if not collection.active and not collection.self_review:
|
||||
raise Http404("Exam not found")
|
||||
|
||||
if not collection.check_cid_user(cid, passcode, request):
|
||||
@@ -1268,7 +1268,9 @@ def collection_take_overview(
|
||||
if cid is not None:
|
||||
answers = CidReportAnswer.objects.filter(cid=cid, question__in=case_details)
|
||||
else:
|
||||
answers = UserReportAnswer.objects.filter(user=request.user, question__in=case_details)
|
||||
answers = UserReportAnswer.objects.filter(
|
||||
user=request.user, question__in=case_details
|
||||
)
|
||||
|
||||
answer_question_map = {}
|
||||
for ans in answers:
|
||||
@@ -1283,7 +1285,9 @@ def collection_take_overview(
|
||||
else:
|
||||
question_answer_tuples.append((q, None))
|
||||
|
||||
cid_user_exam = collection.get_or_create_cid_user_exam(cid=cid, user_user=request.user)
|
||||
cid_user_exam = collection.get_or_create_cid_user_exam(
|
||||
cid=cid, user_user=request.user
|
||||
)
|
||||
|
||||
return render(
|
||||
request,
|
||||
@@ -1317,7 +1321,7 @@ def collection_case_view_take(
|
||||
answer: CidReportAnswer | UserReportAnswer
|
||||
|
||||
if collection.collection_type != collection.COLLECTION_TYPE_CHOICES.REVIEW:
|
||||
if not collection.active:
|
||||
if not collection.active and not collection.self_review:
|
||||
raise Http404("Exam not found")
|
||||
|
||||
if cid is not None and not collection.check_cid_user(cid, passcode, request):
|
||||
@@ -1439,7 +1443,7 @@ def collection_case_view(request, pk, case_number):
|
||||
answer = None
|
||||
|
||||
if collection.collection_type != collection.COLLECTION_TYPE_CHOICES.REVIEW:
|
||||
if not collection.active:
|
||||
if not collection.active and not collection.self_review:
|
||||
raise Http404("Exam not found")
|
||||
|
||||
cases = collection.cases.all().order_by("casedetail__sort_order").prefetch_related()
|
||||
|
||||
Reference in New Issue
Block a user