mirror of
https://github.com/evgen-app/evg-app-back.git
synced 2024-11-22 08:46:34 +03:00
last hack commit
This commit is contained in:
parent
726d7c576b
commit
ac3d5338aa
Binary file not shown.
|
@ -24,11 +24,12 @@ class CreateLesson(graphene.Mutation):
|
||||||
subject = graphene.ID()
|
subject = graphene.ID()
|
||||||
|
|
||||||
ok = graphene.Boolean()
|
ok = graphene.Boolean()
|
||||||
|
lesson = graphene.Field(LessonType)
|
||||||
|
|
||||||
def mutate(self, info, name, descr, subject):
|
def mutate(self, info, name, descr, subject):
|
||||||
Lesson.objects.create(name=name, descr=descr, type_lesson=
|
lesson = Lesson.objects.create(name=name, descr=descr, type_lesson=
|
||||||
SubjectClassLocal.objects.get(pk=subject))
|
SubjectClassLocal.objects.get(id=from_global_id(subject)[1]))
|
||||||
return CreateLesson(ok=True)
|
return CreateLesson(ok=True, lesson=lesson)
|
||||||
|
|
||||||
class UpdateLessonRegistration(graphene.Mutation):
|
class UpdateLessonRegistration(graphene.Mutation):
|
||||||
class Arguments:
|
class Arguments:
|
||||||
|
@ -83,13 +84,14 @@ class updateTestRegistration(graphene.Mutation):
|
||||||
test = graphene.Field(TestsType)
|
test = graphene.Field(TestsType)
|
||||||
|
|
||||||
def mutate(self, info, test_id, name=None, deadline=None):
|
def mutate(self, info, test_id, name=None, deadline=None):
|
||||||
test = Tests.objects.get(id=test_id)
|
test = Tests.objects.get(id=from_global_id(test_id)[1])
|
||||||
name_changed = test.name
|
name_changed = test.name
|
||||||
deadline_changed = test.deadline
|
deadline_changed = test.deadline
|
||||||
if name != None: name_changed = name
|
if name != None: name_changed = name
|
||||||
if deadline != None : deadline_changed = deadline
|
if deadline != None : deadline_changed = deadline
|
||||||
test.name = name_changed
|
test.name = name_changed
|
||||||
test.deadline = deadline_changed
|
test.deadline = deadline_changed
|
||||||
|
test.save()
|
||||||
return updateTestRegistration(test)
|
return updateTestRegistration(test)
|
||||||
from collections.abc import Mapping
|
from collections.abc import Mapping
|
||||||
|
|
||||||
|
@ -99,7 +101,7 @@ class deleteTest(graphene.Mutation):
|
||||||
ok = graphene.Boolean()
|
ok = graphene.Boolean()
|
||||||
|
|
||||||
def mutate(self, info, test_id):
|
def mutate(self, info, test_id):
|
||||||
test = Tests.objects.get(id=test_id)
|
test = Tests.objects.get(id=from_global_id(test_id)[1])
|
||||||
test.delete()
|
test.delete()
|
||||||
return deleteTest(ok=True)
|
return deleteTest(ok=True)
|
||||||
|
|
||||||
|
@ -170,7 +172,7 @@ class updateTask(graphene.Mutation):
|
||||||
"practise": [practise, task.practise],
|
"practise": [practise, task.practise],
|
||||||
"number": [number, task.number],
|
"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],
|
"Type": [taskType(from_global_id(Type)[1]), task.Type],
|
||||||
"is_autoCheck": [autoCheck, task.is_autoCheck],
|
"is_autoCheck": [autoCheck, task.is_autoCheck],
|
||||||
"autoCheckData": [autoCheckData, task.autoCheckData],
|
"autoCheckData": [autoCheckData, task.autoCheckData],
|
||||||
"is_timing": [is_time, task.is_timing],
|
"is_timing": [is_time, task.is_timing],
|
||||||
|
|
Loading…
Reference in New Issue
Block a user