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

Drop DocumentationByPersonType

parent aa94a9c1
No related branches found
No related tags found
1 merge request!361Resolve "Add statistics page for absences"
...@@ -17,7 +17,7 @@ from aleksis.core.schema.person import PersonType ...@@ -17,7 +17,7 @@ from aleksis.core.schema.person import PersonType
from aleksis.core.util.core_helpers import get_site_preferences, has_person from aleksis.core.util.core_helpers import get_site_preferences, has_person
from ..model_extensions import annotate_person_statistics_for_school_term from ..model_extensions import annotate_person_statistics_for_school_term
from ..models import Documentation from ..models import Documentation, ParticipationStatus, NewPersonalNote
from .absences import ( from .absences import (
AbsencesForPersonsCreateMutation, AbsencesForPersonsCreateMutation,
) )
...@@ -36,16 +36,15 @@ from .extra_marks import ( ...@@ -36,16 +36,15 @@ from .extra_marks import (
from .participation_status import ( from .participation_status import (
ExtendParticipationStatusToAbsenceBatchMutation, ExtendParticipationStatusToAbsenceBatchMutation,
ParticipationStatusBatchPatchMutation, ParticipationStatusBatchPatchMutation,
ParticipationStatusType,
) )
from .personal_note import ( from .personal_note import (
PersonalNoteBatchCreateMutation, PersonalNoteBatchCreateMutation,
PersonalNoteBatchDeleteMutation, PersonalNoteBatchDeleteMutation,
PersonalNoteBatchPatchMutation, PersonalNoteBatchPatchMutation,
PersonalNoteType,
) )
from .statistics import ( from .statistics import StatisticsByPersonType
DocumentationByPersonType,
StatisticsByPersonType,
)
class Query(graphene.ObjectType): class Query(graphene.ObjectType):
...@@ -84,8 +83,13 @@ class Query(graphene.ObjectType): ...@@ -84,8 +83,13 @@ class Query(graphene.ObjectType):
person=graphene.ID(required=True), person=graphene.ID(required=True),
term=graphene.ID(required=True), term=graphene.ID(required=True),
) )
documentations_by_person = graphene.List( participations_of_person = graphene.List(
DocumentationByPersonType, ParticipationStatusType,
person=graphene.ID(required=True),
term=graphene.ID(required=False),
)
personal_notes_for_person = graphene.List(
PersonalNoteType,
person=graphene.ID(required=True), person=graphene.ID(required=True),
term=graphene.ID(required=False), term=graphene.ID(required=False),
) )
...@@ -261,9 +265,14 @@ class Query(graphene.ObjectType): ...@@ -261,9 +265,14 @@ class Query(graphene.ObjectType):
).first() ).first()
@staticmethod @staticmethod
def resolve_documentations_by_person(root, info, person, term=None): def resolve_participations_of_person(root, info, person, term=None):
# TODO: Annotate person with necessary information for term. # TODO: only current term
return Person.objects.filter(id=person) return ParticipationStatus.objects.filter(person=person, absence_reason__isnull=False)
@staticmethod
def resolve_personal_notes_for_person(root, info, person, term=None):
# TODO: only current term
return NewPersonalNote.objects.filter(person=person)
@staticmethod @staticmethod
def resolve_statistics_by_group(root, info, group, term=None): def resolve_statistics_by_group(root, info, group, term=None):
......
...@@ -65,42 +65,3 @@ class StatisticsByPersonType(graphene.ObjectType): ...@@ -65,42 +65,3 @@ class StatisticsByPersonType(graphene.ObjectType):
dict(extra_mark=extra_mark, count=getattr(root, extra_mark.count_label)) dict(extra_mark=extra_mark, count=getattr(root, extra_mark.count_label))
for extra_mark in ExtraMark.objects.all() for extra_mark in ExtraMark.objects.all()
] ]
class DocumentationByPersonType(graphene.ObjectType):
id = graphene.ID()
datetime_start = graphene.Date()
datetime_end = graphene.Date()
group_short_name = graphene.String()
teacher = graphene.Field(PersonType)
subject = graphene.Field(SubjectType)
absences = graphene.List(AbsenceReasonType)
extra_marks = graphene.List(ExtraMarkType)
personal_note = graphene.String()
def resolve_id(root, info):
return 1
def resolve_datetime_start(root, info):
return timezone.now().replace(2024, 5, 27, 9, 0)
def resolve_datetime_end(root, info):
return timezone.now().replace(2024, 5, 27, 10, 0)
def resolve_group_short_name(root, info):
return "11b"
def resolve_teacher(root, info):
return Person.objects.last()
def resolve_subject(root, info):
return Subject.objects.first()
def resolve_absences(root, info):
return AbsenceReason.objects.all()
def resolve_extra_marks(root, info):
return ExtraMark.objects.all()
def resolve_personal_note(root, info):
return "All is well:)"
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