Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
AlekSIS-App-Alsijil
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
AlekSIS®
Official
AlekSIS-App-Alsijil
Commits
a1a65655
Commit
a1a65655
authored
10 months ago
by
permcu
Browse files
Options
Downloads
Patches
Plain Diff
Implement statistics query resolvers
parent
b08ceda7
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!361
Resolve "Add statistics page for absences"
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
aleksis/apps/alsijil/schema/__init__.py
+10
-0
10 additions, 0 deletions
aleksis/apps/alsijil/schema/__init__.py
aleksis/apps/alsijil/schema/statistics.py
+29
-0
29 additions, 0 deletions
aleksis/apps/alsijil/schema/statistics.py
with
39 additions
and
0 deletions
aleksis/apps/alsijil/schema/__init__.py
+
10
−
0
View file @
a1a65655
...
@@ -174,6 +174,16 @@ class Query(graphene.ObjectType):
...
@@ -174,6 +174,16 @@ class Query(graphene.ObjectType):
return
lessons_for_person
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
)
@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
()
class
Mutation
(
graphene
.
ObjectType
):
class
Mutation
(
graphene
.
ObjectType
):
create_or_update_documentations
=
DocumentationBatchCreateOrUpdateMutation
.
Field
()
create_or_update_documentations
=
DocumentationBatchCreateOrUpdateMutation
.
Field
()
...
...
This diff is collapsed.
Click to expand it.
aleksis/apps/alsijil/schema/statistics.py
+
29
−
0
View file @
a1a65655
import
graphene
import
graphene
from
aleksis.apps.kolego.models.absence
import
AbsenceReason
from
aleksis.apps.kolego.schema.absence
import
AbsenceReasonType
from
aleksis.apps.kolego.schema.absence
import
AbsenceReasonType
from
..models
import
ExtraMark
from
.personal_note
import
ExtraMarkType
from
.personal_note
import
ExtraMarkType
class
AbsenceReasonWithCountType
(
graphene
.
ObjectType
):
class
AbsenceReasonWithCountType
(
graphene
.
ObjectType
):
absence_reason
=
graphene
.
Field
(
AbsenceReasonType
)
absence_reason
=
graphene
.
Field
(
AbsenceReasonType
)
count
=
graphene
.
Int
()
count
=
graphene
.
Int
()
def
resolve_count
(
root
,
info
):
return
6
class
ExtraMarkWithCountType
(
graphene
.
ObjectType
):
class
ExtraMarkWithCountType
(
graphene
.
ObjectType
):
extra_mark
=
graphene
.
Field
(
ExtraMarkType
)
extra_mark
=
graphene
.
Field
(
ExtraMarkType
)
count
=
graphene
.
Int
()
count
=
graphene
.
Int
()
def
resolve_count
(
root
,
info
):
return
7
class
StatisticsByPersonType
(
graphene
.
ObjectType
):
class
StatisticsByPersonType
(
graphene
.
ObjectType
):
participation_count
=
graphene
.
Int
()
participation_count
=
graphene
.
Int
()
absence_count
=
graphene
.
Int
()
absence_count
=
graphene
.
Int
()
...
@@ -17,3 +25,24 @@ class StatisticsByPersonType(graphene.ObjectType):
...
@@ -17,3 +25,24 @@ class StatisticsByPersonType(graphene.ObjectType):
tardiness_sum
=
graphene
.
Int
()
tardiness_sum
=
graphene
.
Int
()
tardiness_count
=
graphene
.
Int
()
tardiness_count
=
graphene
.
Int
()
extra_marks
=
graphene
.
List
(
ExtraMarkWithCountType
)
extra_marks
=
graphene
.
List
(
ExtraMarkWithCountType
)
def
resolve_participation_count
(
root
,
info
):
return
3
def
resolve_absence_count
(
root
,
info
):
return
1
def
resolve_absence_reasons
(
root
,
info
):
# TODO: Return actual AbsenceReasons
# Needed by resolve_absence_count as well.
return
AbsenceReason
.
objects
.
all
()
def
resolve_tardiness_sum
(
root
,
info
):
return
17
def
resolve_tardiness_count
(
root
,
info
):
return
5
def
resolve_extra_marks
(
root
,
info
):
# TODO: Return actual ExtraMarks
return
ExtraMark
.
objects
.
all
()
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment