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):
|
class SeriesFinding(models.Model):
|
||||||
series = models.ForeignKey(
|
series = models.ForeignKey(
|
||||||
"Series", related_name="findings", on_delete=models.SET_NULL, null=True
|
"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
|
self.pk, self.get_examination_full(), self.description, case_id
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
def get_absolute_url(self):
|
def get_absolute_url(self):
|
||||||
return reverse("atlas:series_detail", kwargs={"pk": self.pk})
|
return reverse("atlas:series_detail", kwargs={"pk": self.pk})
|
||||||
|
|
||||||
def get_link(self):
|
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):
|
class CaseCollection(ExamCollectionGenericBase):
|
||||||
@@ -476,6 +475,12 @@ class CaseCollection(ExamCollectionGenericBase):
|
|||||||
archive = models.BooleanField(default=False)
|
archive = models.BooleanField(default=False)
|
||||||
exam_mode = 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(
|
open_access = models.BooleanField(
|
||||||
help_text="If the exam is freely accessible (to view and edit on the test system)",
|
help_text="If the exam is freely accessible (to view and edit on the test system)",
|
||||||
default=False,
|
default=False,
|
||||||
@@ -550,8 +555,6 @@ class BaseReportAnswer(models.Model):
|
|||||||
else:
|
else:
|
||||||
raise ValueError("No cid or user specified")
|
raise ValueError("No cid or user specified")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
abstract = True
|
abstract = True
|
||||||
|
|
||||||
|
|||||||
@@ -31,6 +31,8 @@
|
|||||||
|
|
||||||
Start time: {{cid_user_exam.start_time}}
|
Start time: {{cid_user_exam.start_time}}
|
||||||
|
|
||||||
|
<p>Completed: {{cid_user_exam.completed}}</p>
|
||||||
|
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
{% block js %}
|
{% block js %}
|
||||||
|
|||||||
+9
-5
@@ -1255,7 +1255,7 @@ def collection_take_overview(
|
|||||||
):
|
):
|
||||||
collection = get_object_or_404(CaseCollection, pk=pk)
|
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")
|
raise Http404("Exam not found")
|
||||||
|
|
||||||
if not collection.check_cid_user(cid, passcode, request):
|
if not collection.check_cid_user(cid, passcode, request):
|
||||||
@@ -1268,7 +1268,9 @@ def collection_take_overview(
|
|||||||
if cid is not None:
|
if cid is not None:
|
||||||
answers = CidReportAnswer.objects.filter(cid=cid, question__in=case_details)
|
answers = CidReportAnswer.objects.filter(cid=cid, question__in=case_details)
|
||||||
else:
|
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 = {}
|
answer_question_map = {}
|
||||||
for ans in answers:
|
for ans in answers:
|
||||||
@@ -1283,7 +1285,9 @@ def collection_take_overview(
|
|||||||
else:
|
else:
|
||||||
question_answer_tuples.append((q, None))
|
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(
|
return render(
|
||||||
request,
|
request,
|
||||||
@@ -1317,7 +1321,7 @@ def collection_case_view_take(
|
|||||||
answer: CidReportAnswer | UserReportAnswer
|
answer: CidReportAnswer | UserReportAnswer
|
||||||
|
|
||||||
if collection.collection_type != collection.COLLECTION_TYPE_CHOICES.REVIEW:
|
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")
|
raise Http404("Exam not found")
|
||||||
|
|
||||||
if cid is not None and not collection.check_cid_user(cid, passcode, request):
|
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
|
answer = None
|
||||||
|
|
||||||
if collection.collection_type != collection.COLLECTION_TYPE_CHOICES.REVIEW:
|
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")
|
raise Http404("Exam not found")
|
||||||
|
|
||||||
cases = collection.cases.all().order_by("casedetail__sort_order").prefetch_related()
|
cases = collection.cases.all().order_by("casedetail__sort_order").prefetch_related()
|
||||||
|
|||||||
@@ -0,0 +1,18 @@
|
|||||||
|
# Generated by Django 4.1.4 on 2023-07-03 12:47
|
||||||
|
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('generic', '0004_examination_modality'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AddField(
|
||||||
|
model_name='ciduserexam',
|
||||||
|
name='completed',
|
||||||
|
field=models.BooleanField(default=False, help_text='If a exam has be completed. This will usually lock the exam to further reponses.'),
|
||||||
|
),
|
||||||
|
]
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
# Generated by Django 4.1.4 on 2023-07-03 12:50
|
||||||
|
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('generic', '0005_ciduserexam_completed'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='ciduserexam',
|
||||||
|
name='completed',
|
||||||
|
field=models.BooleanField(default=False, help_text='If a exam has been completed. This will usually lock the exam to further reponses.'),
|
||||||
|
),
|
||||||
|
]
|
||||||
@@ -1044,6 +1044,11 @@ class CidUserExam(models.Model):
|
|||||||
start_time = models.DateTimeField(blank=True, null=True)
|
start_time = models.DateTimeField(blank=True, null=True)
|
||||||
end_time = models.DateTimeField(blank=True, null=True)
|
end_time = models.DateTimeField(blank=True, null=True)
|
||||||
|
|
||||||
|
completed = models.BooleanField(
|
||||||
|
default=False,
|
||||||
|
help_text="If a exam has been completed. This will usually lock the exam to further reponses.",
|
||||||
|
)
|
||||||
|
|
||||||
cid_user = models.ForeignKey(
|
cid_user = models.ForeignKey(
|
||||||
CidUser,
|
CidUser,
|
||||||
on_delete=models.CASCADE,
|
on_delete=models.CASCADE,
|
||||||
|
|||||||
Reference in New Issue
Block a user