diff --git a/aleksis/apps/alsijil/frontend/components/coursebook/statistics/StatisticsForPersonCard.vue b/aleksis/apps/alsijil/frontend/components/coursebook/statistics/StatisticsForPersonCard.vue index 17cf823216d547f494eab2419b7f1ecd4092494e..a5498363b3ac05acdeed5409e5e7728157482824 100644 --- a/aleksis/apps/alsijil/frontend/components/coursebook/statistics/StatisticsForPersonCard.vue +++ b/aleksis/apps/alsijil/frontend/components/coursebook/statistics/StatisticsForPersonCard.vue @@ -31,7 +31,7 @@ import StatisticsTardinessCard from "./StatisticsTardinessCard.vue"; import StatisticsExtraMarksCard from "./StatisticsExtraMarksCard.vue"; import StatisticsPersonalNotesList from "./StatisticsPersonalNotesList.vue"; -import statisticsByPerson from "./statistics.graphql"; +import { statisticsByPerson } from "./statistics.graphql"; export default { name: "StatisticsForPersonCard", diff --git a/aleksis/apps/alsijil/frontend/components/coursebook/statistics/statistics.graphql b/aleksis/apps/alsijil/frontend/components/coursebook/statistics/statistics.graphql index 266702ea6a9a4e06d1a981d23ddf9f04fec44245..e9f1e5d52f4d5368762dfd64b07b2d0e6b667fc0 100644 --- a/aleksis/apps/alsijil/frontend/components/coursebook/statistics/statistics.graphql +++ b/aleksis/apps/alsijil/frontend/components/coursebook/statistics/statistics.graphql @@ -8,7 +8,7 @@ fragment statistics on StatisticsByPersonType { shortName name colour - countAsAbsent + default } } tardinessSum @@ -21,34 +21,36 @@ fragment statistics on StatisticsByPersonType { name colourFg colourBg - showInCourseBook + showInCoursebook } } } query statisticsByPerson ( - $personId: ID! - $termId: ID! + $person: ID! + $term: ID! ) { statistics: statisticsByPerson( - $personId: ID! - $termId: ID! + person: $person + term: $term ) { ...statistics + } } query statisticsByGroup ( - $groupId: ID! - $termId: ID! + $group: ID! + $term: ID! ) { statistics: statisticsByGroup( - $groupId: ID! - $termId: ID! + group: $group + term: $term ) { persons { id firstName lastName ...statistics + } } } diff --git a/aleksis/apps/alsijil/schema/__init__.py b/aleksis/apps/alsijil/schema/__init__.py index 0c7c299f08a10f6502646f0304863c322f129f1c..c49e6e91c622392a591181aa21da51c7fdc62159 100644 --- a/aleksis/apps/alsijil/schema/__init__.py +++ b/aleksis/apps/alsijil/schema/__init__.py @@ -49,8 +49,16 @@ class Query(graphene.ObjectType): end=graphene.Date(required=True), ) - statistics_by_person = graphene.Field(StatisticsByPersonType) - statistics_by_group = graphene.List(StatisticsByPersonType) + statistics_by_person = graphene.Field( + StatisticsByPersonType, + person=graphene.ID(), + term=graphene.ID(), + ) + statistics_by_group = graphene.List( + StatisticsByPersonType, + group=graphene.ID(), + term=graphene.ID(), + ) def resolve_documentations_by_course_id(root, info, course_id, **kwargs): documentations = Documentation.objects.filter( @@ -175,14 +183,14 @@ class Query(graphene.ObjectType): return lessons_for_person @staticmethod - def resolve_statistics_by_person(root, info, person_id, term_id): - # TODO: Annotate person with necessary information for term_id. - return Person.objects.get(id=person_id) + def resolve_statistics_by_person(root, info, person, term): + # TODO: Annotate person with necessary information for term. + return Person.objects.get(id=person) @staticmethod - def resolve_statistics_by_group(root, info, group_id, term_id): - # TODO: Annotate persons with necessary information for term_id. - return Group.objects.get(id=group_id).members.all() + def resolve_statistics_by_group(root, info, group, term): + # TODO: Annotate persons with necessary information for term. + return Group.objects.get(id=group).members.all() class Mutation(graphene.ObjectType):