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
d0dc97e9
Commit
d0dc97e9
authored
4 months ago
by
Julian
Browse files
Options
Downloads
Patches
Plain Diff
Drop DocumentationByPersonType
parent
aa94a9c1
No related branches found
No related tags found
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
+19
-10
19 additions, 10 deletions
aleksis/apps/alsijil/schema/__init__.py
aleksis/apps/alsijil/schema/statistics.py
+0
-39
0 additions, 39 deletions
aleksis/apps/alsijil/schema/statistics.py
with
19 additions
and
49 deletions
aleksis/apps/alsijil/schema/__init__.py
+
19
−
10
View file @
d0dc97e9
...
...
@@ -17,7 +17,7 @@ from aleksis.core.schema.person import PersonType
from
aleksis.core.util.core_helpers
import
get_site_preferences
,
has_person
from
..model_extensions
import
annotate_person_statistics_for_school_term
from
..models
import
Documentation
from
..models
import
Documentation
,
ParticipationStatus
,
NewPersonalNote
from
.absences
import
(
AbsencesForPersonsCreateMutation
,
)
...
...
@@ -36,16 +36,15 @@ from .extra_marks import (
from
.participation_status
import
(
ExtendParticipationStatusToAbsenceBatchMutation
,
ParticipationStatusBatchPatchMutation
,
ParticipationStatusType
,
)
from
.personal_note
import
(
PersonalNoteBatchCreateMutation
,
PersonalNoteBatchDeleteMutation
,
PersonalNoteBatchPatchMutation
,
PersonalNoteType
,
)
from
.statistics
import
(
DocumentationByPersonType
,
StatisticsByPersonType
,
)
from
.statistics
import
StatisticsByPersonType
class
Query
(
graphene
.
ObjectType
):
...
...
@@ -84,8 +83,13 @@ class Query(graphene.ObjectType):
person
=
graphene
.
ID
(
required
=
True
),
term
=
graphene
.
ID
(
required
=
True
),
)
documentations_by_person
=
graphene
.
List
(
DocumentationByPersonType
,
participations_of_person
=
graphene
.
List
(
ParticipationStatusType
,
person
=
graphene
.
ID
(
required
=
True
),
term
=
graphene
.
ID
(
required
=
False
),
)
personal_notes_for_person
=
graphene
.
List
(
PersonalNoteType
,
person
=
graphene
.
ID
(
required
=
True
),
term
=
graphene
.
ID
(
required
=
False
),
)
...
...
@@ -261,9 +265,14 @@ class Query(graphene.ObjectType):
).
first
()
@staticmethod
def
resolve_documentations_by_person
(
root
,
info
,
person
,
term
=
None
):
# TODO: Annotate person with necessary information for term.
return
Person
.
objects
.
filter
(
id
=
person
)
def
resolve_participations_of_person
(
root
,
info
,
person
,
term
=
None
):
# TODO: only current term
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
def
resolve_statistics_by_group
(
root
,
info
,
group
,
term
=
None
):
...
...
This diff is collapsed.
Click to expand it.
aleksis/apps/alsijil/schema/statistics.py
+
0
−
39
View file @
d0dc97e9
...
...
@@ -65,42 +65,3 @@ class StatisticsByPersonType(graphene.ObjectType):
dict
(
extra_mark
=
extra_mark
,
count
=
getattr
(
root
,
extra_mark
.
count_label
))
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:)
"
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