Files
2023-06-12 11:14:19 +01:00

131 lines
8.2 KiB
Python

# Generated by Django 4.1.4 on 2023-06-12 10:07
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
import django.utils.timezone
import sortedm2m.fields
class Migration(migrations.Migration):
initial = True
dependencies = [
('generic', '0001_initial'),
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
]
operations = [
migrations.CreateModel(
name='Category',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('category', models.CharField(max_length=200)),
],
),
migrations.CreateModel(
name='Exam',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('name', models.CharField(help_text='Name of the exam', max_length=200)),
('active', models.BooleanField(default=False, help_text='If an exam should be available to take')),
('exam_mode', models.BooleanField(default=False, help_text='If an exam should be taken in exam mode (users results will be submited to the server for marking)')),
('include_history', models.BooleanField(default=False, help_text='If an exam should include history when taking')),
('publish_results', models.BooleanField(default=False, help_text='If an exams results should be available')),
('json_creation_time', models.DateTimeField(blank=True, default=None, null=True)),
('exam_json_id', models.IntegerField(default=1, help_text='auto incrementing field when json recreated')),
('archive', models.BooleanField(default=False, help_text='Archived exams will remain on the test system but will not be displayed by default')),
('open_access', models.BooleanField(default=False, help_text='If the exam is freely accessible (to view and edit on the test system)')),
('authors_only', models.BooleanField(default=False, help_text='If true only exam authors will be able to view.')),
('stats_mean', models.FloatField(default=0)),
('stats_mode', models.CharField(default=0, max_length=25)),
('stats_median', models.FloatField(default=0)),
('stats_candidates', models.FloatField(default=0)),
('stats_min', models.FloatField(default=0)),
('stats_max', models.FloatField(default=0)),
('stats_max_possible', models.FloatField(default=0)),
('user_scores', models.JSONField(default=dict)),
('exam_results_emailed', models.DateTimeField(default=None, null=True)),
('time_limit', models.IntegerField(blank=True, help_text='Exam time limit (in seconds)', null=True)),
('author', models.ManyToManyField(blank=True, help_text='Author of exam', related_name='physics_exam_author', to=settings.AUTH_USER_MODEL)),
('cid_user_groups', models.ManyToManyField(blank=True, help_text='These groups define which candidates are able to be added to the exams/collection.', related_name='physics_cid_user_groups', to='generic.cidusergroup')),
],
options={
'abstract': False,
},
),
migrations.CreateModel(
name='Question',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('authors_only', models.BooleanField(default=False, help_text='If true only question authors will be able to view.')),
('created_date', models.DateTimeField(default=django.utils.timezone.now)),
('open_access', models.BooleanField(default=True, help_text='If a question should be freely available to browse')),
('feedback', models.TextField(blank=True, help_text='Question Feedback', null=True)),
('stem', models.TextField(help_text='Stem of the question')),
('a', models.TextField(help_text='The question text')),
('a_answer', models.BooleanField(default=True, help_text='Answer (check for true, uncheck for false)')),
('a_feedback', models.TextField(blank=True, help_text='Feedback for answer')),
('b', models.TextField(help_text='The question text')),
('b_answer', models.BooleanField(default=True, help_text='Answer (check for true, uncheck for false)')),
('b_feedback', models.TextField(blank=True, help_text='Feedback for answer')),
('c', models.TextField(help_text='The question text')),
('c_answer', models.BooleanField(default=True, help_text='Answer (check for true, uncheck for false)')),
('c_feedback', models.TextField(blank=True, help_text='Feedback for answer')),
('d', models.TextField(help_text='The question text')),
('d_answer', models.BooleanField(default=True, help_text='Answer (check for true, uncheck for false)')),
('d_feedback', models.TextField(blank=True, help_text='Feedback for answer')),
('e', models.TextField(help_text='The question text')),
('e_answer', models.BooleanField(default=True, help_text='Answer (check for true, uncheck for false)')),
('e_feedback', models.TextField(blank=True, help_text='Feedback for answer')),
('author', models.ManyToManyField(blank=True, help_text='Author(s) of question', related_name='physics_authored_questions', to=settings.AUTH_USER_MODEL)),
('category', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='physics.category')),
],
options={
'abstract': False,
},
),
migrations.CreateModel(
name='UserAnswer',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('cid', models.BigIntegerField(blank=True, help_text='Candidate ID (limitied by BigIntegerField size)', null=True)),
('created', models.DateTimeField(auto_now_add=True)),
('updated', models.DateTimeField(auto_now=True)),
('a', models.BooleanField()),
('b', models.BooleanField()),
('c', models.BooleanField()),
('d', models.BooleanField()),
('e', models.BooleanField()),
('exam', models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, related_name='cid_user_answers', to='physics.exam')),
('question', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='cid_user_answers', to='physics.question')),
('user', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='user_physics_user_answers', to=settings.AUTH_USER_MODEL)),
],
options={
'ordering': ['cid'],
'abstract': False,
},
),
migrations.AddField(
model_name='exam',
name='exam_questions',
field=sortedm2m.fields.SortedManyToManyField(blank='true', help_text=None, related_name='exams', to='physics.question'),
),
migrations.AddField(
model_name='exam',
name='user_user_groups',
field=models.ManyToManyField(blank=True, help_text='These groups define which candidates are able to be added to the exams/collection.', related_name='physics_user_user_groups', to='generic.userusergroup'),
),
migrations.AddField(
model_name='exam',
name='valid_cid_users',
field=models.ManyToManyField(blank=True, related_name='physics_exams', to='generic.ciduser'),
),
migrations.AddField(
model_name='exam',
name='valid_user_users',
field=models.ManyToManyField(blank=True, related_name='user_physics_exams', to=settings.AUTH_USER_MODEL),
),
]