# Generated by Django 3.1.2 on 2021-01-16 00:06

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


class Migration(migrations.Migration):

    initial = True

    dependencies = [
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
        ('courses', '0003_auto_20201225_2229'),
        ('activity', '0008_activity_banned_users'),
    ]

    operations = [
        migrations.CreateModel(
            name='Qualification',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('total_score', models.IntegerField(default=0)),
                ('finish', models.BooleanField(default=False)),
                ('total_correct_questions', models.IntegerField(default=0)),
            ],
        ),
        migrations.CreateModel(
            name='Question',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('text', models.CharField(max_length=500)),
                ('question_score', models.IntegerField()),
                ('question_negative_score', models.IntegerField(default=0)),
            ],
        ),
        migrations.CreateModel(
            name='Quiz',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('title', models.CharField(max_length=50)),
                ('description', models.CharField(blank=True, max_length=500, null=True)),
                ('maximum_date', models.DateTimeField(blank=True, null=True, verbose_name='Maximum Date')),
                ('repeatable', models.BooleanField()),
                ('show_qualification', models.BooleanField(default=False)),
                ('show_quiz', models.BooleanField(default=False)),
                ('activity', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='activity.activity')),
                ('course', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='courses.course')),
            ],
        ),
        migrations.CreateModel(
            name='QuestionAsked',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('num_correct_answers', models.IntegerField(default=0)),
                ('num_incorrect_answers', models.IntegerField(default=0)),
                ('qualification', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='quiz.qualification')),
                ('question', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='quiz.question')),
            ],
        ),
        migrations.AddField(
            model_name='question',
            name='quiz',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='quiz.quiz'),
        ),
        migrations.AddField(
            model_name='qualification',
            name='questions_asked',
            field=models.ManyToManyField(related_name='questions_asked_qualification', through='quiz.QuestionAsked', to='quiz.Question'),
        ),
        migrations.AddField(
            model_name='qualification',
            name='quiz',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='quiz.quiz'),
        ),
        migrations.AddField(
            model_name='qualification',
            name='user',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL),
        ),
        migrations.CreateModel(
            name='Answer',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('text', models.CharField(max_length=500)),
                ('correct', models.BooleanField()),
                ('question', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='quiz.question')),
            ],
        ),
        migrations.AddConstraint(
            model_name='quiz',
            constraint=models.CheckConstraint(check=models.Q(models.Q(('activity__isnull', True), ('course__isnull', False)), models.Q(('activity__isnull', False), ('course__isnull', True)), _connector='OR'), name='Quiz_activityAndCourse_are_null_or_notnull'),
        ),
    ]

# Generated by Django 3.1.2 on 2021-01-16 00:06

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


class Migration(migrations.Migration):

    initial = True

    dependencies = [
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
        ('courses', '0003_auto_20201225_2229'),
        ('activity', '0008_activity_banned_users'),
    ]

    operations = [
        migrations.CreateModel(
            name='Qualification',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('total_score', models.IntegerField(default=0)),
                ('finish', models.BooleanField(default=False)),
                ('total_correct_questions', models.IntegerField(default=0)),
            ],
        ),
        migrations.CreateModel(
            name='Question',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('text', models.CharField(max_length=500)),
                ('question_score', models.IntegerField()),
                ('question_negative_score', models.IntegerField(default=0)),
            ],
        ),
        migrations.CreateModel(
            name='Quiz',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('title', models.CharField(max_length=50)),
                ('description', models.CharField(blank=True, max_length=500, null=True)),
                ('maximum_date', models.DateTimeField(blank=True, null=True, verbose_name='Maximum Date')),
                ('repeatable', models.BooleanField()),
                ('show_qualification', models.BooleanField(default=False)),
                ('show_quiz', models.BooleanField(default=False)),
                ('activity', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='activity.activity')),
                ('course', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='courses.course')),
            ],
        ),
        migrations.CreateModel(
            name='QuestionAsked',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('num_correct_answers', models.IntegerField(default=0)),
                ('num_incorrect_answers', models.IntegerField(default=0)),
                ('qualification', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='quiz.qualification')),
                ('question', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='quiz.question')),
            ],
        ),
        migrations.AddField(
            model_name='question',
            name='quiz',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='quiz.quiz'),
        ),
        migrations.AddField(
            model_name='qualification',
            name='questions_asked',
            field=models.ManyToManyField(related_name='questions_asked_qualification', through='quiz.QuestionAsked', to='quiz.Question'),
        ),
        migrations.AddField(
            model_name='qualification',
            name='quiz',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='quiz.quiz'),
        ),
        migrations.AddField(
            model_name='qualification',
            name='user',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL),
        ),
        migrations.CreateModel(
            name='Answer',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('text', models.CharField(max_length=500)),
                ('correct', models.BooleanField()),
                ('question', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='quiz.question')),
            ],
        ),
        migrations.AddConstraint(
            model_name='quiz',
            constraint=models.CheckConstraint(check=models.Q(models.Q(('activity__isnull', True), ('course__isnull', False)), models.Q(('activity__isnull', False), ('course__isnull', True)), _connector='OR'), name='Quiz_activityAndCourse_are_null_or_notnull'),
        ),
    ]

# Generated by Django 3.1.2 on 2021-01-16 00:06