# Generated by Django 3.2.12 on 2024-05-31 07:26

from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
import django.utils.timezone


class Migration(migrations.Migration):

    initial = True

    dependencies = [
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
        ('system', '0003_alter_permission_parent'),
    ]

    operations = [
        migrations.CreateModel(
            name='AnswerDetail',
            fields=[
                ('id', models.CharField(editable=False, help_text='主键ID', max_length=20, primary_key=True, serialize=False, verbose_name='主键ID')),
                ('create_time', models.DateTimeField(default=django.utils.timezone.now, help_text='创建时间', verbose_name='创建时间')),
                ('update_time', models.DateTimeField(auto_now=True, help_text='修改时间', verbose_name='修改时间')),
                ('is_deleted', models.BooleanField(default=False, help_text='删除标记', verbose_name='删除标记')),
                ('total_score', models.FloatField(default=0, verbose_name='该题满分')),
                ('user_answer', models.JSONField(blank=True, null=True)),
                ('score', models.FloatField(default=0, verbose_name='本题得分')),
                ('is_right', models.BooleanField(default=False, verbose_name='是否正确')),
            ],
            options={
                'verbose_name': '答题记录',
                'verbose_name_plural': '答题记录',
            },
        ),
        migrations.CreateModel(
            name='Exam',
            fields=[
                ('id', models.CharField(editable=False, help_text='主键ID', max_length=20, primary_key=True, serialize=False, verbose_name='主键ID')),
                ('create_time', models.DateTimeField(default=django.utils.timezone.now, help_text='创建时间', verbose_name='创建时间')),
                ('update_time', models.DateTimeField(auto_now=True, help_text='修改时间', verbose_name='修改时间')),
                ('is_deleted', models.BooleanField(default=False, help_text='删除标记', verbose_name='删除标记')),
                ('name', models.CharField(max_length=100, verbose_name='名称')),
                ('open_time', models.DateTimeField(verbose_name='开启时间')),
                ('close_time', models.DateTimeField(blank=True, null=True, verbose_name='关闭时间')),
                ('chance', models.IntegerField(default=1, verbose_name='考试机会')),
                ('is_public', models.BooleanField(default=False, verbose_name='是否公开')),
                ('create_by', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='exam_create_by', to=settings.AUTH_USER_MODEL, verbose_name='创建人')),
                ('p_depts', models.ManyToManyField(blank=True, to='system.Dept', verbose_name='指定部门')),
                ('p_users', models.ManyToManyField(blank=True, to=settings.AUTH_USER_MODEL, verbose_name='指定用户')),
            ],
            options={
                'verbose_name': '在线考试',
                'verbose_name_plural': '在线考试',
            },
        ),
        migrations.CreateModel(
            name='Paper',
            fields=[
                ('id', models.CharField(editable=False, help_text='主键ID', max_length=20, primary_key=True, serialize=False, verbose_name='主键ID')),
                ('create_time', models.DateTimeField(default=django.utils.timezone.now, help_text='创建时间', verbose_name='创建时间')),
                ('update_time', models.DateTimeField(auto_now=True, help_text='修改时间', verbose_name='修改时间')),
                ('is_deleted', models.BooleanField(default=False, help_text='删除标记', verbose_name='删除标记')),
                ('name', models.CharField(max_length=200, verbose_name='名称')),
                ('limit', models.IntegerField(default=0, verbose_name='限时(分钟)')),
                ('total_score', models.FloatField(default=0, verbose_name='满分')),
                ('pass_score', models.FloatField(default=0, verbose_name='通过分数')),
                ('danxuan_count', models.IntegerField(default=0, verbose_name='单选数量')),
                ('danxuan_score', models.FloatField(default=2, verbose_name='单选分数')),
                ('duoxuan_count', models.IntegerField(default=0, verbose_name='多选数量')),
                ('duoxuan_score', models.FloatField(default=4, verbose_name='多选分数')),
                ('panduan_count', models.IntegerField(default=0, verbose_name='判断数量')),
                ('panduan_score', models.FloatField(default=2, verbose_name='判断分数')),
                ('create_by', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='paper_create_by', to=settings.AUTH_USER_MODEL, verbose_name='创建人')),
            ],
            options={
                'verbose_name': '押题卷',
                'verbose_name_plural': '押题卷',
            },
        ),
        migrations.CreateModel(
            name='Questioncat',
            fields=[
                ('id', models.CharField(editable=False, help_text='主键ID', max_length=20, primary_key=True, serialize=False, verbose_name='主键ID')),
                ('create_time', models.DateTimeField(default=django.utils.timezone.now, help_text='创建时间', verbose_name='创建时间')),
                ('update_time', models.DateTimeField(auto_now=True, help_text='修改时间', verbose_name='修改时间')),
                ('is_deleted', models.BooleanField(default=False, help_text='删除标记', verbose_name='删除标记')),
                ('name', models.CharField(max_length=200, verbose_name='名称')),
                ('sort', models.PositiveIntegerField(default=0, verbose_name='排序')),
                ('create_by', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='questioncat_create_by', to=settings.AUTH_USER_MODEL, verbose_name='创建人')),
                ('parent', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='cate_parent', to='edu.questioncat', verbose_name='父级')),
                ('update_by', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='questioncat_update_by', to=settings.AUTH_USER_MODEL, verbose_name='最后编辑人')),
            ],
            options={
                'verbose_name': '题库分类',
                'verbose_name_plural': '题库分类',
            },
        ),
        migrations.CreateModel(
            name='Question',
            fields=[
                ('id', models.CharField(editable=False, help_text='主键ID', max_length=20, primary_key=True, serialize=False, verbose_name='主键ID')),
                ('create_time', models.DateTimeField(default=django.utils.timezone.now, help_text='创建时间', verbose_name='创建时间')),
                ('update_time', models.DateTimeField(auto_now=True, help_text='修改时间', verbose_name='修改时间')),
                ('is_deleted', models.BooleanField(default=False, help_text='删除标记', verbose_name='删除标记')),
                ('name', models.TextField(verbose_name='题干')),
                ('img', models.TextField(blank=True, null=True, verbose_name='题干图片')),
                ('type', models.PositiveSmallIntegerField(choices=[(10, '单选'), (20, '多选'), (30, '判断')], verbose_name='题型')),
                ('level', models.PositiveSmallIntegerField(choices=[(10, '简单'), (20, '一般'), (30, '困难')], default=20, verbose_name='难度')),
                ('options', models.JSONField(verbose_name='选项')),
                ('right', models.JSONField(verbose_name='正确答案')),
                ('resolution', models.TextField(blank=True, null=True, verbose_name='解析')),
                ('enabled', models.BooleanField(default=False, verbose_name='是否启用')),
                ('create_by', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='question_create_by', to=settings.AUTH_USER_MODEL, verbose_name='创建人')),
                ('questioncat', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='questioncat', to='edu.questioncat', verbose_name='所属题库')),
                ('update_by', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='question_update_by', to=settings.AUTH_USER_MODEL, verbose_name='最后编辑人')),
            ],
            options={
                'verbose_name': '题目',
                'verbose_name_plural': '题目',
            },
        ),
        migrations.CreateModel(
            name='PaperQuestion',
            fields=[
                ('id', models.CharField(editable=False, help_text='主键ID', max_length=20, primary_key=True, serialize=False, verbose_name='主键ID')),
                ('create_time', models.DateTimeField(default=django.utils.timezone.now, help_text='创建时间', verbose_name='创建时间')),
                ('update_time', models.DateTimeField(auto_now=True, help_text='修改时间', verbose_name='修改时间')),
                ('is_deleted', models.BooleanField(default=False, help_text='删除标记', verbose_name='删除标记')),
                ('total_score', models.FloatField(default=0, verbose_name='单题满分')),
                ('sort', models.IntegerField(default=0, verbose_name='排序')),
                ('paper', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='edu.paper', verbose_name='试卷')),
                ('question', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='edu.question', verbose_name='试题')),
            ],
            options={
                'abstract': False,
            },
        ),
        migrations.AddField(
            model_name='paper',
            name='questions',
            field=models.ManyToManyField(through='edu.PaperQuestion', to='edu.Question'),
        ),
        migrations.AddField(
            model_name='paper',
            name='update_by',
            field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='paper_update_by', to=settings.AUTH_USER_MODEL, verbose_name='最后编辑人'),
        ),
        migrations.CreateModel(
            name='ExamRecord',
            fields=[
                ('id', models.CharField(editable=False, help_text='主键ID', max_length=20, primary_key=True, serialize=False, verbose_name='主键ID')),
                ('create_time', models.DateTimeField(default=django.utils.timezone.now, help_text='创建时间', verbose_name='创建时间')),
                ('update_time', models.DateTimeField(auto_now=True, help_text='修改时间', verbose_name='修改时间')),
                ('is_deleted', models.BooleanField(default=False, help_text='删除标记', verbose_name='删除标记')),
                ('score', models.FloatField(default=0, verbose_name='得分')),
                ('took', models.IntegerField(default=0, verbose_name='耗时(秒)')),
                ('start_time', models.DateTimeField(verbose_name='开始答题时间')),
                ('end_time', models.DateTimeField(blank=True, null=True, verbose_name='结束答题时间')),
                ('is_pass', models.BooleanField(default=True, verbose_name='是否通过')),
                ('is_submited', models.BooleanField(default=False, verbose_name='是否提交')),
                ('is_last', models.BooleanField(default=False, verbose_name='是否最后一次考试记录')),
                ('create_by', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='examrecord_create_by', to=settings.AUTH_USER_MODEL, verbose_name='创建人')),
                ('exam', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='record_exam', to='edu.exam', verbose_name='关联考试')),
                ('questions', models.ManyToManyField(through='edu.AnswerDetail', to='edu.Question', verbose_name='答题记录')),
                ('update_by', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='examrecord_update_by', to=settings.AUTH_USER_MODEL, verbose_name='最后编辑人')),
            ],
            options={
                'verbose_name': '考试记录',
                'verbose_name_plural': '考试记录',
            },
        ),
        migrations.AddField(
            model_name='exam',
            name='paper',
            field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='edu.paper', verbose_name='使用的试卷'),
        ),
        migrations.AddField(
            model_name='exam',
            name='update_by',
            field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='exam_update_by', to=settings.AUTH_USER_MODEL, verbose_name='最后编辑人'),
        ),
        migrations.AddField(
            model_name='answerdetail',
            name='examrecord',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='detail_er', to='edu.examrecord'),
        ),
        migrations.AddField(
            model_name='answerdetail',
            name='question',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='edu.question'),
        ),
    ]
