# Generated by Django 3.2 on 2021-05-17 18:09

from django.conf import settings
import django.contrib.postgres.fields
from django.db import migrations, models
import django.db.models.deletion
import programming_assignments.models


class Migration(migrations.Migration):

    initial = True

    dependencies = [
        ('course', '0001_initial'),
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
    ]

    operations = [
        migrations.CreateModel(
            name='AssignmentSection',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=100)),
                ('description', models.TextField(blank=True)),
                ('section_type', models.CharField(choices=[('V', 'Visible'), ('H', 'Hidden')], default='V', max_length=1)),
                ('compiler_command', models.CharField(blank=True, max_length=100)),
                ('execution_command', models.CharField(blank=True, max_length=100)),
                ('created_on', models.DateTimeField(auto_now_add=True)),
                ('modified_on', models.DateTimeField(auto_now=True)),
            ],
        ),
        migrations.CreateModel(
            name='Exam',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('duration', models.DurationField()),
                ('late_duration', models.DurationField()),
                ('allowed_ip_range', models.CharField(max_length=100)),
                ('created_on', models.DateTimeField(auto_now_add=True)),
                ('modified_on', models.DateTimeField(auto_now=True)),
            ],
        ),
        migrations.CreateModel(
            name='SimpleProgrammingAssignment',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('programming_language', models.CharField(choices=[('C', 'C'), ('C++', 'C++'), ('Java', 'Java'), ('Python', 'Python'), ('Others', 'Others')], max_length=10)),
                ('document', models.FileField(blank=True, null=True, upload_to=programming_assignments.models.programming_assignment_file_upload_path)),
                ('name', models.CharField(max_length=100)),
                ('description', models.TextField(blank=True)),
                ('is_published', models.BooleanField(default=False)),
                ('start_date', models.DateTimeField()),
                ('end_date', models.DateTimeField()),
                ('extended_date', models.DateTimeField()),
                ('created_on', models.DateTimeField(auto_now_add=True)),
                ('modified_on', models.DateTimeField(auto_now=True)),
                ('course', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='course.course')),
            ],
        ),
        migrations.CreateModel(
            name='SimpleProgrammingAssignmentHistory',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('instructor_feedback', models.TextField(blank=True)),
                ('file_submitted', models.FileField(upload_to=programming_assignments.models.programming_assignment_file_upload_path)),
                ('created_on', models.DateTimeField(auto_now_add=True)),
                ('modified_on', models.DateTimeField(auto_now=True)),
                ('simple_prog_assignment', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='programming_assignments.simpleprogrammingassignment')),
                ('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
            ],
        ),
        migrations.CreateModel(
            name='TAAllocation',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('mapping', models.JSONField()),
            ],
        ),
        migrations.CreateModel(
            name='Testcase',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=100)),
                ('cmd_line_args', django.contrib.postgres.fields.ArrayField(base_field=models.CharField(max_length=100), blank=True, null=True, size=None)),
                ('marks', models.FloatField(default=0)),
                ('input_file', models.FileField(blank=True, null=True, upload_to=programming_assignments.models.programming_assignment_file_upload_path)),
                ('output_file', models.FileField(blank=True, null=True, upload_to=programming_assignments.models.programming_assignment_file_upload_path)),
                ('is_published', models.BooleanField(default=False)),
                ('created_on', models.DateTimeField(auto_now_add=True)),
                ('modified_on', models.DateTimeField(auto_now=True)),
                ('assignment', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='programming_assignments.simpleprogrammingassignment')),
                ('assignment_section', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='programming_assignments.assignmentsection')),
            ],
        ),
        migrations.CreateModel(
            name='AdvancedProgrammingAssignment',
            fields=[
                ('simpleprogrammingassignment_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='programming_assignments.simpleprogrammingassignment')),
                ('helper_code', models.FileField(blank=True, null=True, upload_to=programming_assignments.models.programming_assignment_file_upload_path)),
                ('instructor_solution_code', models.FileField(blank=True, null=True, upload_to=programming_assignments.models.programming_assignment_file_upload_path)),
                ('files_to_be_submitted', django.contrib.postgres.fields.ArrayField(base_field=models.CharField(max_length=100), blank=True, size=None)),
                ('ta_allocation_file', models.FileField(blank=True, null=True, upload_to=programming_assignments.models.programming_assignment_file_upload_path)),
                ('policy', models.CharField(choices=[('A', 'Automated'), ('P', 'Previous'), ('N', 'New')], default='A', max_length=1)),
                ('execution_time_calculate', models.BooleanField(default=False)),
                ('ignore_whitespaces_in_output', models.BooleanField(default=False)),
                ('indentation_percentage_calculate', models.BooleanField(default=False)),
            ],
            bases=('programming_assignments.simpleprogrammingassignment',),
        ),
        migrations.CreateModel(
            name='AdvancedProgrammingAssignmentHistory',
            fields=[
                ('simpleprogrammingassignmenthistory_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='programming_assignments.simpleprogrammingassignmenthistory')),
                ('execution_time', models.FloatField(blank=True, null=True)),
                ('indentation_percentage', models.FloatField(blank=True, null=True)),
            ],
            bases=('programming_assignments.simpleprogrammingassignmenthistory',),
        ),
        migrations.CreateModel(
            name='TestcaseHistory',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('marks_obtained', models.FloatField(default=0)),
                ('created_on', models.DateTimeField(auto_now_add=True)),
                ('modified_on', models.DateTimeField(auto_now=True)),
                ('testcase', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='programming_assignments.testcase')),
                ('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
            ],
        ),
        migrations.CreateModel(
            name='ExamHistory',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('ip_address', django.contrib.postgres.fields.ArrayField(base_field=models.CharField(max_length=100), blank=True, size=None)),
                ('is_paused', models.BooleanField(default=False)),
                ('is_approved', models.BooleanField(default=True)),
                ('start_time', models.DateTimeField()),
                ('remaining_time', models.DurationField()),
                ('additional_time', django.contrib.postgres.fields.ArrayField(base_field=models.FloatField(), blank=True, null=True, size=None)),
                ('created_on', models.DateTimeField(auto_now_add=True)),
                ('modified_on', models.DateTimeField(auto_now=True)),
                ('exam', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='programming_assignments.exam')),
                ('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
            ],
        ),
        migrations.AddField(
            model_name='exam',
            name='assignment',
            field=models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, to='programming_assignments.simpleprogrammingassignment'),
        ),
        migrations.AddField(
            model_name='assignmentsection',
            name='assignment',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='programming_assignments.simpleprogrammingassignment'),
        ),
        migrations.AddConstraint(
            model_name='testcase',
            constraint=models.CheckConstraint(check=models.Q(('assignment__isnull', False), ('assignment_section__isnull', False), _connector='OR'), name='both_not_null_in_testcase'),
        ),
        migrations.AddField(
            model_name='advancedprogrammingassignment',
            name='ta_allocation',
            field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='programming_assignments.taallocation'),
        ),
    ]
