Skip to content
Snippets Groups Projects
Commit 19adf0c0 authored by permcu's avatar permcu
Browse files

Use get_documentations_for_events in lessons_for_persons query

& use documentations instead of lesson-events
parent 13701153
No related branches found
No related tags found
1 merge request!361Resolve "Add statistics page for absences"
...@@ -21,12 +21,20 @@ query lessonsForPersons( ...@@ -21,12 +21,20 @@ query lessonsForPersons(
id id
datetimeStart datetimeStart
datetimeEnd datetimeEnd
course course {
subject id
name
}
subject {
id
name
shortName
colourFg
colourBg
}
} }
} }
} }
# TODO: course is missing in LessonEventType
# Use absencesInputType # Use absencesInputType
mutation createAbsences( mutation createAbsences(
......
...@@ -18,7 +18,10 @@ from .documentation import ( ...@@ -18,7 +18,10 @@ from .documentation import (
DocumentationBatchCreateOrUpdateMutation, DocumentationBatchCreateOrUpdateMutation,
DocumentationType, DocumentationType,
) )
from .absences import (
LessonsForPersonType,
AbsencesBatchCreateMutation,
)
class Query(graphene.ObjectType): class Query(graphene.ObjectType):
documentations = FilterOrderList(DocumentationType) documentations = FilterOrderList(DocumentationType)
...@@ -159,15 +162,19 @@ class Query(graphene.ObjectType): ...@@ -159,15 +162,19 @@ class Query(graphene.ObjectType):
"obj_id": PERSON_ID, "obj_id": PERSON_ID,
} }
events = LessonEvent.get_single_events(
datetime.combine(start, datetime.min.time()),
datetime.combine(end, datetime.max.time()),
None,
event_params,
with_reference_object=True,
)
docs, dummies = Documentation.get_documentations_for_events(events)
lessons_for_person.append( lessons_for_person.append(
id=person, id=person,
lessons=LessonEvent.get_single_events( lessons=docs + dummies
datetime.combine(start, datetime.min.time()),
datetime.combine(date_end, datetime.max.time()),
None,
event_params,
with_reference_object=True,
)
) )
return lessons_for_person return lessons_for_person
......
import graphene import graphene
from aleksis.apps.chronos.schema import LessonEventType from .documentation import DocumentationType
class LessonsForPersonType(graphene.ObjectType): class LessonsForPersonType(graphene.ObjectType):
id = graphene.ID() # noqa id = graphene.ID() # noqa
lessons = graphene.List(LessonEventType) lessons = graphene.List(DocumentationType)
class AbsencesBatchCreateMutation(graphene.Mutation): class AbsencesBatchCreateMutation(graphene.Mutation):
class Arguments: class Arguments:
......
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