some refactoring and atlas improvements
This commit is contained in:
@@ -0,0 +1,43 @@
|
||||
# Generated by Django 4.1.4 on 2023-07-24 09:24
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('physics', '0001_initial'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AddField(
|
||||
model_name='exam',
|
||||
name='candidates_only',
|
||||
field=models.BooleanField(default=True, help_text='If the exam/collection is only available to candidates who have been added'),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='exam',
|
||||
name='active',
|
||||
field=models.BooleanField(default=False, help_text='If an exam/collection should be available to take'),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='exam',
|
||||
name='archive',
|
||||
field=models.BooleanField(default=False, help_text='Archived exams/collections will remain on the test system but will not be displayed by default'),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='exam',
|
||||
name='name',
|
||||
field=models.CharField(help_text='Name of the exam/collection', max_length=200),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='exam',
|
||||
name='open_access',
|
||||
field=models.BooleanField(default=False, help_text='If the exam/collection is freely accessible (to view and edit on the test system)'),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='exam',
|
||||
name='publish_results',
|
||||
field=models.BooleanField(default=False, help_text='If an exam/collections results should be available'),
|
||||
),
|
||||
]
|
||||
+3
-15
@@ -103,12 +103,7 @@ def active_exams(request):
|
||||
def exam_scores_cid_user(request, pk, cid=None, passcode=None):
|
||||
exam = get_object_or_404(Exam, pk=pk)
|
||||
|
||||
if not exam.exam_mode:
|
||||
raise Http404("Packet not in exam mode")
|
||||
|
||||
print(cid, passcode, request.user)
|
||||
if not exam.check_cid_user(cid, passcode, request):
|
||||
raise Http404("Error accessing exam")
|
||||
exam.check_user_can_review(cid, passcode, request)
|
||||
|
||||
questions = exam.exam_questions.all()
|
||||
|
||||
@@ -208,11 +203,7 @@ def exam_start(request, pk):
|
||||
def exam_take_overview(request, pk, cid=None, passcode=None):
|
||||
exam = get_object_or_404(Exam, pk=pk)
|
||||
|
||||
if not exam.active:
|
||||
return exam_inactive(request, context={"exam": exam})
|
||||
|
||||
if not exam.check_cid_user(cid, passcode, request):
|
||||
raise Http404("Error accessing exam")
|
||||
exam.check_user_can_take(cid, passcode, request)
|
||||
|
||||
questions = exam.exam_questions.all()
|
||||
|
||||
@@ -258,10 +249,7 @@ def exam_take(request, pk: int, sk: int, cid: str| None = None, passcode: str| N
|
||||
if not exam.active:
|
||||
return exam_inactive(request, context={"exam": exam})
|
||||
|
||||
if not exam.check_cid_user(cid, passcode, request):
|
||||
raise Http404("Error accessing exam")
|
||||
|
||||
print(cid, passcode, request.user)
|
||||
exam.check_user_can_take(cid, passcode, request)
|
||||
|
||||
cid_user_exam = exam.get_or_create_cid_user_exam(cid=cid, user_user=request.user)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user