From 0aca9c6dac9436c1e81de5c6351f69382721a4d9 Mon Sep 17 00:00:00 2001 From: Michael Bauer <michael-bauer@posteo.de> Date: Thu, 2 May 2024 17:06:14 +0200 Subject: [PATCH] WIP Update sketch --- .../absences/absenceCreation.graphql | 1 + aleksis/apps/alsijil/schema/__init__.py | 21 ++++++++++++++----- aleksis/apps/alsijil/schema/absences.py | 1 + 3 files changed, 18 insertions(+), 5 deletions(-) diff --git a/aleksis/apps/alsijil/frontend/components/coursebook/absences/absenceCreation.graphql b/aleksis/apps/alsijil/frontend/components/coursebook/absences/absenceCreation.graphql index 6c73bfad4..130b5cabb 100644 --- a/aleksis/apps/alsijil/frontend/components/coursebook/absences/absenceCreation.graphql +++ b/aleksis/apps/alsijil/frontend/components/coursebook/absences/absenceCreation.graphql @@ -1,3 +1,4 @@ +# Use core persons query query persons { persons: persons { id diff --git a/aleksis/apps/alsijil/schema/__init__.py b/aleksis/apps/alsijil/schema/__init__.py index 029a12e5b..fd813944b 100644 --- a/aleksis/apps/alsijil/schema/__init__.py +++ b/aleksis/apps/alsijil/schema/__init__.py @@ -38,7 +38,7 @@ class Query(graphene.ObjectType): courses_of_person = FilterOrderList(CourseType, person=graphene.ID()) lessons_for_persons = FilterOrderList( - PersonAbsencesType??, + LessonForPerson, # person graphene.List(LessonEvent) persons=graphene.List(graphene.ID, required=True), start=graphene.Date(required=True), end=graphene.Date(required=True), @@ -134,21 +134,32 @@ class Query(graphene.ObjectType): # Do date like resolve_documentations_for_coursebook? # Get all lesson events for person - # Make this reusable for mutation + # Make this reusable for mutation -> Einzeiler # Pack into (id fullname lesson (start end course subject ...)) - + event_params = { - "" + "type": "PARTICIPANT", + "obj_id": PERSON_ID, } + # get_objects (lesson_events chronos models.py) + # adapt own -> person as param + # _put list of person IDs in event_params_ + events = LessonEvent.get_single_events( start, end, - request??, + None, event_params, with_reference_object=True, ) + return [id + + get_single_events -> python object ical + # Use own graphene types (wrapper, & event + # then populate them here + return class Mutation(graphene.ObjectType): diff --git a/aleksis/apps/alsijil/schema/absences.py b/aleksis/apps/alsijil/schema/absences.py index f7c27a92b..323ceb192 100644 --- a/aleksis/apps/alsijil/schema/absences.py +++ b/aleksis/apps/alsijil/schema/absences.py @@ -18,6 +18,7 @@ class AbsencesBatchCreateMutation(graphene.Mutation): # has lesson event lookup as well & returns real & fake documentations # => extract & reuse the documentation lookup) # Create a ParticipationStatus for each documentation + # (OR if no documentation and in past create documentation) # If there are any LessonEvents without a documentation # create a Kolego Absence for the whole duration # Return ok=True if everything went well. -- GitLab