Skip to content
Snippets Groups Projects
Commit e540bc0e authored by Julian's avatar Julian
Browse files

Change default values in schema to None

parent e1bac805
No related branches found
No related tags found
Loading
......@@ -82,16 +82,13 @@ class PersonalNoteMutation(graphene.Mutation):
person_id,
lesson_documentation,
personal_note_id=None,
late=0,
absent=False,
excused=False,
late=None,
absent=None,
excused=None,
excuse_type=None,
remarks="",
remarks=None,
extra_marks=None
):
if extra_marks is None:
extra_marks = []
person = Person.objects.get(pk=person_id)
lesson_documentation = LessonDocumentation.objects.get(pk=lesson_documentation)
......@@ -103,22 +100,26 @@ class PersonalNoteMutation(graphene.Mutation):
week=lesson_documentation.week,
year=lesson_documentation.year,
)
if late:
if late is not None:
personal_note.late = late
if absent is not None:
personal_note.absent = absent
if excused is not None:
personal_note.excused = excused
if excuse_type:
if excuse_type is not None:
personal_note.excuse_type = ExcuseType.objects.get(pk=excuse_type)
if remarks:
if remarks is not None:
personal_note.remarks = remarks
personal_note.save()
extra_marks = ExtraMark.objects.filter(pk__in=extra_marks)
personal_note.extra_marks.set(extra_marks)
personal_note.groups_of_person.set(person.member_of.all())
if created:
personal_note.groups_of_person.set(person.member_of.all())
personal_note.save()
if extra_marks is not None:
extra_marks = ExtraMark.objects.filter(pk__in=extra_marks)
personal_note.extra_marks.set(extra_marks)
personal_note.save()
return PersonalNoteMutation(personal_note=personal_note)
......
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