mirror of
https://github.com/evgen-app/evg-app-back.git
synced 2024-11-10 19:26:33 +03:00
change back
This commit is contained in:
parent
2aa03e4c6b
commit
726d7c576b
78
TasksType.json
Normal file
78
TasksType.json
Normal file
|
@ -0,0 +1,78 @@
|
|||
[
|
||||
{
|
||||
"model": "lessons.TaskType",
|
||||
"pk":1,
|
||||
"fields" : {
|
||||
"name":"прочитать текст"
|
||||
}
|
||||
},
|
||||
{
|
||||
"model": "lessons.TaskType",
|
||||
"pk":10,
|
||||
"fields" : {
|
||||
"name":"выбрать правильный вариант ответа"
|
||||
}
|
||||
},
|
||||
{
|
||||
"model": "lessons.TaskType",
|
||||
"pk":9,
|
||||
"fields" : {
|
||||
"name":"расставить заголвки"
|
||||
|
||||
}
|
||||
},
|
||||
{
|
||||
"model": "lessons.TaskType",
|
||||
"pk":8,
|
||||
"fields": {
|
||||
"name":"правда/ложь"
|
||||
}
|
||||
},
|
||||
{
|
||||
"model": "lessons.TaskType",
|
||||
"pk":7,
|
||||
"fields" : {
|
||||
"name":"краткий письменный ответ"
|
||||
|
||||
}
|
||||
},
|
||||
{
|
||||
"model": "lessons.TaskType",
|
||||
"pk":6,
|
||||
"fields" : {
|
||||
"name":"опишите устно изображение"
|
||||
|
||||
}
|
||||
},
|
||||
{
|
||||
"model": "lessons.TaskType",
|
||||
"pk":5,
|
||||
"fields" : {
|
||||
"name":"установите соответствия"
|
||||
|
||||
}
|
||||
},
|
||||
{
|
||||
"model": "lessons.TaskType",
|
||||
"pk":4,
|
||||
"fields" : {
|
||||
"name":"расширенный письменный ответ"
|
||||
}
|
||||
},
|
||||
{
|
||||
"model": "lessons.TaskType",
|
||||
"pk":3,
|
||||
"fields" : {
|
||||
"name":"монологическое высказывание на выбранную тему"
|
||||
|
||||
}
|
||||
},
|
||||
{
|
||||
"model": "lessons.TaskType",
|
||||
"pk":2,
|
||||
"fields" : {
|
||||
"name":"загрузка файла"
|
||||
|
||||
}
|
||||
}
|
||||
]
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -1,7 +1,7 @@
|
|||
import graphene
|
||||
import graphene_django
|
||||
|
||||
from .models import Subject, Lesson, SubjectClassLocal, Tests, Task, AnswerSheet, Answer, Materials
|
||||
from .models import Subject, Lesson, SubjectClassLocal, Tests, Task, AnswerSheet, Answer, Materials, TaskType as taskType
|
||||
from organisations.gqlTypes import ChildType, TeacherType
|
||||
|
||||
from organisations.models import Organisation, Group, Child, Teacher
|
||||
|
@ -16,6 +16,11 @@ from django.db.models import Model
|
|||
class Material(graphene_django.DjangoObjectType):
|
||||
class Meta:
|
||||
model = Materials
|
||||
interfaces = (relay.Node,)
|
||||
filter_fields = {
|
||||
"name": ("exact",)
|
||||
}
|
||||
|
||||
|
||||
class AnswerType(graphene_django.DjangoObjectType):
|
||||
class Meta:
|
||||
|
@ -144,3 +149,8 @@ class LocalSubjectType(graphene_django.DjangoObjectType):
|
|||
return len(self.lesson_set.all())
|
||||
|
||||
|
||||
class TaskTypeType(graphene_django.DjangoObjectType):
|
||||
class Meta:
|
||||
model = taskType
|
||||
interfaces = (relay.Node,)
|
||||
filter_fields = {}
|
|
@ -1,4 +1,4 @@
|
|||
# Generated by Django 3.1.5 on 2021-01-08 20:17
|
||||
# Generated by Django 3.1.5 on 2021-02-05 08:53
|
||||
|
||||
from django.db import migrations, models
|
||||
import django.db.models.deletion
|
||||
|
@ -9,10 +9,20 @@ class Migration(migrations.Migration):
|
|||
initial = True
|
||||
|
||||
dependencies = [
|
||||
('organisations', '0004_auto_20210108_2013'),
|
||||
('organisations', '0005_auto_20210120_1944'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.CreateModel(
|
||||
name='Lesson',
|
||||
fields=[
|
||||
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||
('name', models.TextField(default='')),
|
||||
('descr', models.TextField(default='')),
|
||||
('content', models.TextField(default='')),
|
||||
('time_lesson', models.DateTimeField(auto_now=True)),
|
||||
],
|
||||
),
|
||||
migrations.CreateModel(
|
||||
name='Subject',
|
||||
fields=[
|
||||
|
@ -22,6 +32,50 @@ class Migration(migrations.Migration):
|
|||
('teachers_give', models.ManyToManyField(to='organisations.Teacher')),
|
||||
],
|
||||
),
|
||||
migrations.CreateModel(
|
||||
name='Task',
|
||||
fields=[
|
||||
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||
('theory', models.TextField()),
|
||||
('practise', models.TextField()),
|
||||
('number', models.IntegerField()),
|
||||
('max_score', models.IntegerField(default=0)),
|
||||
],
|
||||
),
|
||||
migrations.CreateModel(
|
||||
name='Type',
|
||||
fields=[
|
||||
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||
('name', models.TextField(max_length=150)),
|
||||
],
|
||||
),
|
||||
migrations.CreateModel(
|
||||
name='Theme',
|
||||
fields=[
|
||||
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||
('name', models.CharField(max_length=150)),
|
||||
('tasks', models.ManyToManyField(to='lessons.Task')),
|
||||
],
|
||||
),
|
||||
migrations.CreateModel(
|
||||
name='Tests',
|
||||
fields=[
|
||||
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||
('name', models.CharField(max_length=150)),
|
||||
('deadline', models.DateTimeField()),
|
||||
('lesson', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='lessons.lesson')),
|
||||
],
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='task',
|
||||
name='test',
|
||||
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='lessons.tests'),
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='task',
|
||||
name='types',
|
||||
field=models.ManyToManyField(to='lessons.Type'),
|
||||
),
|
||||
migrations.CreateModel(
|
||||
name='SubjectClassLocal',
|
||||
fields=[
|
||||
|
@ -32,4 +86,40 @@ class Migration(migrations.Migration):
|
|||
('teachers', models.ManyToManyField(to='organisations.Teacher')),
|
||||
],
|
||||
),
|
||||
migrations.CreateModel(
|
||||
name='Materials',
|
||||
fields=[
|
||||
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||
('link', models.URLField()),
|
||||
('name', models.CharField(blank=True, max_length=100)),
|
||||
('data', models.TextField(blank=True)),
|
||||
('Type', models.CharField(default='link', max_length=100)),
|
||||
('lesson', models.ForeignKey(default=3, on_delete=django.db.models.deletion.CASCADE, to='lessons.lesson')),
|
||||
],
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='lesson',
|
||||
name='type_lesson',
|
||||
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='lessons.subjectclasslocal'),
|
||||
),
|
||||
migrations.CreateModel(
|
||||
name='AnswerSheet',
|
||||
fields=[
|
||||
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||
('completed', models.BooleanField(default=False)),
|
||||
('child', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='organisations.child')),
|
||||
('test', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='lessons.tests')),
|
||||
],
|
||||
),
|
||||
migrations.CreateModel(
|
||||
name='Answer',
|
||||
fields=[
|
||||
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||
('content', models.TextField()),
|
||||
('number', models.IntegerField()),
|
||||
('completed', models.BooleanField(default=False)),
|
||||
('score', models.IntegerField(default=0)),
|
||||
('sheet', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='lessons.answersheet')),
|
||||
],
|
||||
),
|
||||
]
|
||||
|
|
|
@ -1,91 +0,0 @@
|
|||
# Generated by Django 3.1.5 on 2021-01-09 12:20
|
||||
|
||||
from django.db import migrations, models
|
||||
import django.db.models.deletion
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('organisations', '0004_auto_20210108_2013'),
|
||||
('lessons', '0001_initial'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.CreateModel(
|
||||
name='Lesson',
|
||||
fields=[
|
||||
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||
('type_lesson', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='lessons.subjectclasslocal')),
|
||||
],
|
||||
),
|
||||
migrations.CreateModel(
|
||||
name='Materials',
|
||||
fields=[
|
||||
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||
('link', models.URLField()),
|
||||
('name', models.CharField(blank=True, max_length=100)),
|
||||
],
|
||||
),
|
||||
migrations.CreateModel(
|
||||
name='Task',
|
||||
fields=[
|
||||
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||
('theory', models.TextField()),
|
||||
('practise', models.TextField()),
|
||||
('number', models.IntegerField()),
|
||||
],
|
||||
),
|
||||
migrations.CreateModel(
|
||||
name='Type',
|
||||
fields=[
|
||||
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||
('name', models.TextField(max_length=150)),
|
||||
],
|
||||
),
|
||||
migrations.CreateModel(
|
||||
name='Theme',
|
||||
fields=[
|
||||
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||
('name', models.CharField(max_length=150)),
|
||||
('tasks', models.ManyToManyField(to='lessons.Task')),
|
||||
],
|
||||
),
|
||||
migrations.CreateModel(
|
||||
name='Tests',
|
||||
fields=[
|
||||
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||
('name', models.CharField(max_length=150)),
|
||||
('deadline', models.DateTimeField()),
|
||||
('lesson', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='lessons.lesson')),
|
||||
],
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='task',
|
||||
name='test',
|
||||
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='lessons.tests'),
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='task',
|
||||
name='type',
|
||||
field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='lessons.type'),
|
||||
),
|
||||
migrations.CreateModel(
|
||||
name='AnswerSheet',
|
||||
fields=[
|
||||
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||
('completed', models.BooleanField(default=False)),
|
||||
('child', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='organisations.child')),
|
||||
('test', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='lessons.tests')),
|
||||
],
|
||||
),
|
||||
migrations.CreateModel(
|
||||
name='Answer',
|
||||
fields=[
|
||||
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||
('content', models.TextField()),
|
||||
('number', models.IntegerField()),
|
||||
('sheet', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='lessons.answersheet')),
|
||||
],
|
||||
),
|
||||
]
|
38
lessons/migrations/0002_auto_20210205_1326.py
Normal file
38
lessons/migrations/0002_auto_20210205_1326.py
Normal file
|
@ -0,0 +1,38 @@
|
|||
# Generated by Django 3.1.5 on 2021-02-05 10:26
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('lessons', '0001_initial'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AddField(
|
||||
model_name='task',
|
||||
name='Type',
|
||||
field=models.CharField(default='line', max_length=150),
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='task',
|
||||
name='autoCheckData',
|
||||
field=models.TextField(blank=True),
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='task',
|
||||
name='is_autoCheck',
|
||||
field=models.BooleanField(default=False),
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='task',
|
||||
name='is_timing',
|
||||
field=models.BooleanField(default=False),
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='task',
|
||||
name='time',
|
||||
field=models.IntegerField(default=30),
|
||||
),
|
||||
]
|
26
lessons/migrations/0003_auto_20210205_1541.py
Normal file
26
lessons/migrations/0003_auto_20210205_1541.py
Normal file
|
@ -0,0 +1,26 @@
|
|||
# Generated by Django 3.1.5 on 2021-02-05 12:41
|
||||
|
||||
from django.db import migrations, models
|
||||
import django.db.models.deletion
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('lessons', '0002_auto_20210205_1326'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.CreateModel(
|
||||
name='TaskType',
|
||||
fields=[
|
||||
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||
('name', models.TextField()),
|
||||
],
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='task',
|
||||
name='Type',
|
||||
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='lessons.tasktype'),
|
||||
),
|
||||
]
|
|
@ -1,18 +0,0 @@
|
|||
# Generated by Django 3.1.5 on 2021-01-13 20:17
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('lessons', '0003_auto_20210113_2224'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AddField(
|
||||
model_name='answer',
|
||||
name='completed',
|
||||
field=models.BooleanField(default=False),
|
||||
),
|
||||
]
|
18
lessons/migrations/0004_auto_20210205_1543.py
Normal file
18
lessons/migrations/0004_auto_20210205_1543.py
Normal file
|
@ -0,0 +1,18 @@
|
|||
# Generated by Django 3.1.5 on 2021-02-05 12:43
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('lessons', '0003_auto_20210205_1541'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterField(
|
||||
model_name='task',
|
||||
name='Type',
|
||||
field=models.CharField(default='line', max_length=150),
|
||||
),
|
||||
]
|
|
@ -1,23 +0,0 @@
|
|||
# Generated by Django 3.1.5 on 2021-01-17 14:52
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('lessons', '0004_answer_completed'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AddField(
|
||||
model_name='answer',
|
||||
name='score',
|
||||
field=models.IntegerField(default=0),
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='task',
|
||||
name='max_score',
|
||||
field=models.IntegerField(default=0),
|
||||
),
|
||||
]
|
19
lessons/migrations/0005_auto_20210205_1544.py
Normal file
19
lessons/migrations/0005_auto_20210205_1544.py
Normal file
|
@ -0,0 +1,19 @@
|
|||
# Generated by Django 3.1.5 on 2021-02-05 12:44
|
||||
|
||||
from django.db import migrations, models
|
||||
import django.db.models.deletion
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('lessons', '0004_auto_20210205_1543'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterField(
|
||||
model_name='task',
|
||||
name='Type',
|
||||
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='lessons.tasktype'),
|
||||
),
|
||||
]
|
|
@ -1,23 +0,0 @@
|
|||
# Generated by Django 3.1.5 on 2021-01-17 17:08
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('lessons', '0005_auto_20210117_1752'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AddField(
|
||||
model_name='lesson',
|
||||
name='descr',
|
||||
field=models.TextField(default=''),
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='lesson',
|
||||
name='name',
|
||||
field=models.TextField(default=''),
|
||||
),
|
||||
]
|
19
lessons/migrations/0006_auto_20210205_1848.py
Normal file
19
lessons/migrations/0006_auto_20210205_1848.py
Normal file
|
@ -0,0 +1,19 @@
|
|||
# Generated by Django 3.1.5 on 2021-02-05 15:48
|
||||
|
||||
from django.db import migrations, models
|
||||
import django.db.models.deletion
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('lessons', '0005_auto_20210205_1544'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterField(
|
||||
model_name='task',
|
||||
name='test',
|
||||
field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='lessons.tests'),
|
||||
),
|
||||
]
|
19
lessons/migrations/0007_auto_20210205_1857.py
Normal file
19
lessons/migrations/0007_auto_20210205_1857.py
Normal file
|
@ -0,0 +1,19 @@
|
|||
# Generated by Django 3.1.5 on 2021-02-05 15:57
|
||||
|
||||
from django.db import migrations, models
|
||||
import django.db.models.deletion
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('lessons', '0006_auto_20210205_1848'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterField(
|
||||
model_name='task',
|
||||
name='test',
|
||||
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='lessons.tests'),
|
||||
),
|
||||
]
|
|
@ -1,18 +0,0 @@
|
|||
# Generated by Django 3.1.5 on 2021-01-30 11:27
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('lessons', '0006_auto_20210117_2008'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AddField(
|
||||
model_name='lesson',
|
||||
name='time_lesson',
|
||||
field=models.DateTimeField(auto_now=True),
|
||||
),
|
||||
]
|
|
@ -1,4 +1,4 @@
|
|||
# Generated by Django 3.1.5 on 2021-01-13 19:24
|
||||
# Generated by Django 3.1.5 on 2021-02-05 15:58
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
@ -6,17 +6,17 @@ from django.db import migrations, models
|
|||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('lessons', '0002_auto_20210109_1220'),
|
||||
('lessons', '0007_auto_20210205_1857'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.RemoveField(
|
||||
model_name='task',
|
||||
name='type',
|
||||
name='test',
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='task',
|
||||
name='types',
|
||||
field=models.ManyToManyField(to='lessons.Type'),
|
||||
name='test',
|
||||
field=models.ManyToManyField(to='lessons.Tests'),
|
||||
),
|
||||
]
|
|
@ -1,19 +0,0 @@
|
|||
# Generated by Django 3.1.5 on 2021-01-30 12:39
|
||||
|
||||
from django.db import migrations, models
|
||||
import django.db.models.deletion
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('lessons', '0007_lesson_time_lesson'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AddField(
|
||||
model_name='materials',
|
||||
name='lesson',
|
||||
field=models.ForeignKey(default=3, on_delete=django.db.models.deletion.CASCADE, to='lessons.lesson'),
|
||||
),
|
||||
]
|
|
@ -1,18 +0,0 @@
|
|||
# Generated by Django 3.1.5 on 2021-01-30 17:08
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('lessons', '0008_materials_lesson'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AddField(
|
||||
model_name='lesson',
|
||||
name='content',
|
||||
field=models.TextField(default=''),
|
||||
),
|
||||
]
|
|
@ -1,23 +0,0 @@
|
|||
# Generated by Django 3.1.5 on 2021-02-02 22:22
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('lessons', '0009_lesson_content'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AddField(
|
||||
model_name='materials',
|
||||
name='Type',
|
||||
field=models.CharField(default='link', max_length=100),
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='materials',
|
||||
name='data',
|
||||
field=models.TextField(blank=True),
|
||||
),
|
||||
]
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -44,16 +44,28 @@ class Tests(models.Model):
|
|||
class Type(models.Model):
|
||||
name = models.TextField(max_length=150)
|
||||
|
||||
|
||||
class TaskType(models.Model):
|
||||
name = models.TextField()
|
||||
|
||||
class Task(models.Model):
|
||||
theory = models.TextField()
|
||||
practise = models.TextField()
|
||||
test = models.ForeignKey(Tests, on_delete=models.CASCADE)
|
||||
test = models.ManyToManyField(Tests)
|
||||
types = models.ManyToManyField(Type)
|
||||
number = models.IntegerField()
|
||||
max_score = models.IntegerField(default=0)
|
||||
is_timing = models.BooleanField(default=False)
|
||||
time = models.IntegerField(default=30)
|
||||
Type = models.ForeignKey(TaskType, on_delete=models.CASCADE)
|
||||
is_autoCheck = models.BooleanField(default=False)
|
||||
autoCheckData = models.TextField(blank=True)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
class Theme(models.Model):
|
||||
tasks = models.ManyToManyField(Task)
|
||||
name = models.CharField(max_length=150)
|
||||
|
@ -78,8 +90,8 @@ def _post_save_receiver_(sender, instance, created, **kwargs):
|
|||
for child in instance.lesson.type_lesson.group.child_set.all():
|
||||
AnswerSheet.objects.create(child=child, completed=False, test=instance)
|
||||
|
||||
@receiver(post_save, sender=Task)
|
||||
'''@receiver(post_save, sender=Task)
|
||||
def _post_save_receiver(sender, instance, created, **kwargs):
|
||||
if created:
|
||||
for child in instance.test.lesson.type_lesson.group.child_set.all():
|
||||
Answer.objects.create(number=instance.number, sheet=child.answersheet_set.all().filter(test=instance.test)[0], content="")
|
||||
Answer.objects.create(number=instance.number, sheet=child.answersheet_set.all().filter(test=instance.test)[0], content="")'''
|
|
@ -38,7 +38,7 @@ class UpdateLessonRegistration(graphene.Mutation):
|
|||
ok = graphene.Boolean()
|
||||
|
||||
def mutate(self, info, id, descr=None, name=None):
|
||||
lesson = Lesson.objects.get(id=id) or None
|
||||
lesson = Lesson.objects.get(id=from_global_id(id)[1]) or None
|
||||
if lesson == None: return UpdateLessonRegistration(ok=False)
|
||||
descr_upd = lesson.descr
|
||||
name_upd = lesson.name
|
||||
|
@ -71,7 +71,7 @@ class CreateTest(graphene.Mutation):
|
|||
test = graphene.Field(TestsType)
|
||||
|
||||
def mutate(self, info, lesson_id, name, deadline=None):
|
||||
lesson = Lesson.objects.get(id=lesson_id)
|
||||
lesson = Lesson.objects.get(id=from_global_id(lesson_id)[1])
|
||||
t = Tests.objects.create(name=name, lesson=lesson, deadline=datetime.datetime.now())
|
||||
return CreateTest(test=t)
|
||||
|
||||
|
@ -129,17 +129,23 @@ class createTask(graphene.Mutation):
|
|||
practise = graphene.String()
|
||||
number = graphene.Int()
|
||||
max_score = graphene.Int()
|
||||
Type = graphene.String()
|
||||
|
||||
task = graphene.Field(TaskType)
|
||||
|
||||
def mutate(self, info, test_id, theory, practise, number, max_score):
|
||||
def mutate(self, info, test_id, theory, practise, number, max_score, Type):
|
||||
task = Tests.objects.get(id=from_global_id(test_id)[1])
|
||||
print(task)
|
||||
m = createModel(model=Task, fields = {
|
||||
"test": Tests.objects.get(id=test_id),
|
||||
"theory": theory,
|
||||
"practise": practise,
|
||||
"number": number,
|
||||
"max_score": max_score
|
||||
"max_score": max_score,
|
||||
"Type" : taskType(id=from_global_id(Type)[1])
|
||||
})
|
||||
print(m)
|
||||
m.test.set([task])
|
||||
m.save()
|
||||
return createTask(task=m)
|
||||
|
||||
class updateTask(graphene.Mutation):
|
||||
|
@ -149,15 +155,26 @@ class updateTask(graphene.Mutation):
|
|||
practise = graphene.String()
|
||||
number = graphene.Int()
|
||||
max_score = graphene.Int()
|
||||
Type = graphene.ID()
|
||||
autoCheck = graphene.Boolean()
|
||||
autoCheckData = graphene.String()
|
||||
is_time = graphene.Boolean()
|
||||
time = graphene.Int()
|
||||
task = graphene.Field(TaskType)
|
||||
|
||||
def mutate(self, info, task_id, theory=None, practise=None, number=None, max_score=None):
|
||||
task = Task.objects.get(id=task_id)
|
||||
def mutate(self, info, task_id, theory=None, practise=None, number=None, max_score=None,
|
||||
Type=None, autoCheck=None, autoCheckData=None, is_time=None, time=None):
|
||||
task = Task.objects.get(id=from_global_id(task_id)[1])
|
||||
m = updateModel(Task, task, {
|
||||
"theory": [theory, task.theory],
|
||||
"practise": [practise, task.practise],
|
||||
"number": [number, task.number],
|
||||
"max_score": [max_score, task.max_score]
|
||||
"max_score": [max_score, task.max_score],
|
||||
"Type": [taskType(from_global_id(Type)), task.Type],
|
||||
"is_autoCheck": [autoCheck, task.is_autoCheck],
|
||||
"autoCheckData": [autoCheckData, task.autoCheckData],
|
||||
"is_timing": [is_time, task.is_timing],
|
||||
"time" : [time, task.time]
|
||||
})
|
||||
return updateTask(task=m)
|
||||
|
||||
|
@ -328,18 +345,52 @@ class CreateMaterial(graphene.Mutation):
|
|||
lesson_id = graphene.ID()
|
||||
data = graphene.String()
|
||||
name = graphene.String()
|
||||
lessonType = graphene.String()
|
||||
|
||||
material = graphene.Field(Material)
|
||||
|
||||
|
||||
def mutate(self, info, lesson_id, data, name):
|
||||
def mutate(self, info, lesson_id, data, name, lessonType):
|
||||
lessonId = from_global_id(lesson_id)[1]
|
||||
print(lessonId)
|
||||
lesson = Lesson.objects.get(id=lessonId)
|
||||
material = Materials.objects.create(lesson=lesson, data=data, link="google.com", name=name)
|
||||
material = Materials.objects.create(lesson=lesson, data=data, link="google.com", name=name, Type=lessonType)
|
||||
return CreateMaterial(material=material)
|
||||
|
||||
|
||||
class DeleteMaterial(graphene.Mutation):
|
||||
class Arguments:
|
||||
material_id = graphene.ID()
|
||||
|
||||
ok = graphene.Boolean()
|
||||
|
||||
|
||||
def mutate(self, info, material_id):
|
||||
material_id = from_global_id(material_id)[1]
|
||||
|
||||
Materials.objects.get(id=material_id).delete()
|
||||
return DeleteMaterial(ok=True)
|
||||
|
||||
|
||||
class ChangeMaterail(graphene.Mutation):
|
||||
class Arguments:
|
||||
material_id = graphene.ID()
|
||||
data = graphene.String()
|
||||
name = graphene.String()
|
||||
|
||||
material = graphene.Field(Material)
|
||||
|
||||
|
||||
def mutate(self, info, material_id, data, name):
|
||||
material_id = from_global_id(material_id)[1]
|
||||
material = Materials.objects.get(id=material_id)
|
||||
material.name = name or material.name
|
||||
material.data = data or material.data
|
||||
material.save()
|
||||
return ChangeMaterail(material=material)
|
||||
|
||||
|
||||
|
||||
class Mutation(graphene.ObjectType):
|
||||
create_lesson = CreateLesson.Field()
|
||||
update_lesson_registration = UpdateLessonRegistration.Field()
|
||||
|
@ -371,6 +422,8 @@ class Mutation(graphene.ObjectType):
|
|||
|
||||
|
||||
create_material = CreateMaterial.Field()
|
||||
deleteMaterial = DeleteMaterial.Field()
|
||||
changeMaterial = ChangeMaterail.Field()
|
||||
|
||||
class Query(graphene.ObjectType):
|
||||
|
||||
|
@ -380,8 +433,7 @@ class Query(graphene.ObjectType):
|
|||
all_subject = DjangoFilterConnectionField(SubjectType)
|
||||
subject = relay.Node.Field(SubjectType)
|
||||
|
||||
task = relay.Node.Field(TaskType)
|
||||
all_task = DjangoFilterConnectionField(TaskType)
|
||||
|
||||
|
||||
answer_sheet = relay.Node.Field(AnswerSheetType)
|
||||
all_answer_sheet = DjangoFilterConnectionField(AnswerSheetType)
|
||||
|
@ -395,4 +447,16 @@ class Query(graphene.ObjectType):
|
|||
subject_class = relay.Node.Field(LocalSubjectType)
|
||||
subject_classes = DjangoFilterConnectionField(LocalSubjectType)
|
||||
|
||||
|
||||
materials = DjangoFilterConnectionField(Material)
|
||||
material = relay.Node.Field(Material)
|
||||
|
||||
gettaskType = relay.Node.Field(TaskTypeType)
|
||||
taskTypes = DjangoFilterConnectionField(TaskTypeType)
|
||||
|
||||
|
||||
tasks = DjangoFilterConnectionField(TaskType)
|
||||
task = relay.Node.Field(TaskType)
|
||||
|
||||
|
||||
schema = graphene.Schema(query=Query)
|
Loading…
Reference in New Issue
Block a user