Skip to content
Snippets Groups Projects
Commit 75514e71 authored by Hangzhi Yu's avatar Hangzhi Yu
Browse files

Fix update/create documentation mutation

parent 37317563
No related branches found
No related tags found
2 merge requests!352Draft: Resolve "Add dialog with each lesson's students",!350Resolve "Add simple course book list"
Pipeline #167074 failed
from datetime import datetime
import graphene import graphene
from graphene_django.types import DjangoObjectType from graphene_django.types import DjangoObjectType
from graphene_django_cud.mutations import ( from graphene_django_cud.mutations import (
...@@ -139,19 +140,18 @@ class DocumentationCreateOrUpdateMutation(graphene.Mutation): ...@@ -139,19 +140,18 @@ class DocumentationCreateOrUpdateMutation(graphene.Mutation):
dummy, lesson_event_id, datetime_start, datetime_end = id.split(";") dummy, lesson_event_id, datetime_start, datetime_end = id.split(";")
obj = Documentation.objects.create( obj = Documentation.objects.create(
datetime_start=datetime_start, datetime_start=datetime.fromisoformat(datetime_start),
datetime_end=datetime_end, datetime_end=datetime.fromisoformat(datetime_end),
lesson_event=LessonEvent.objects.get(id=lesson_event_id), lesson_event=LessonEvent.objects.get(id=lesson_event_id),
topic=input.topic, topic=input.topic,
homework=input.homework, homework=input.homework,
group_note=input.group_note, group_note=input.group_note,
) # TODO: Add course & subject ) # TODO: Add course & subject
else: else:
obj = Documentations.objects.get(id=id) obj = Documentation.objects.get(id=id)
obj.update( obj.topic = input.topic
topic=input.topic, obj.homework = input.homework
homework=input.homework, obj.group_note = input.group_note
group_note=input.group_note, obj.save()
)
return DocumentationCreateOrUpdateMutation(documentation=obj) return DocumentationCreateOrUpdateMutation(documentation=obj)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment