add exam collections

This commit is contained in:
Ross
2024-01-29 09:58:18 +00:00
parent e89cf704ed
commit 04dcb74e67
15 changed files with 186 additions and 7 deletions
@@ -0,0 +1,20 @@
# Generated by Django 4.1.4 on 2024-01-29 09:57
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('generic', '0011_examcollection'),
('rapids', '0003_exam_stats_graph'),
]
operations = [
migrations.AddField(
model_name='exam',
name='exam_collection',
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='rapids_exams', to='generic.examcollection'),
),
]
+3
View File
@@ -28,6 +28,7 @@ from django.contrib.contenttypes.fields import GenericRelation
from generic.models import (
CidUser,
CidUserGroup,
ExamCollection,
ExamUserStatus,
QuestionBase,
Site,
@@ -648,6 +649,8 @@ class Exam(ExamBase):
exam_user_status = GenericRelation(ExamUserStatus)
exam_collection = models.ForeignKey(ExamCollection, blank=True, null=True, on_delete=models.SET_NULL, related_name="rapids_exams")
def get_normal_abnormal_breakdown(self):
# Inefficient but more extendible
questions = self.exam_questions.all()