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