Skip to content
Snippets Groups Projects
Commit 8dfd2d8b authored by permcu's avatar permcu
Browse files

Fix statistics query

parent a2ba6354
No related branches found
No related tags found
1 merge request!361Resolve "Add statistics page for absences"
......@@ -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",
......
......@@ -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
}
}
}
......@@ -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):
......
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