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
eae1c27b
Verified
Commit
eae1c27b
authored
2 months ago
by
Jonathan Weth
Browse files
Options
Downloads
Patches
Plain Diff
Calculate statistics about participations with lesson events
parent
400f4934
No related branches found
No related tags found
1 merge request
!476
Resolve "Not storing groups for documentations is kind of a problem"
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
aleksis/apps/alsijil/model_extensions.py
+3
-9
3 additions, 9 deletions
aleksis/apps/alsijil/model_extensions.py
aleksis/apps/alsijil/tasks.py
+8
-0
8 additions, 0 deletions
aleksis/apps/alsijil/tasks.py
with
11 additions
and
9 deletions
aleksis/apps/alsijil/model_extensions.py
+
3
−
9
View file @
eae1c27b
...
@@ -2,6 +2,7 @@ from django.db.models import FilteredRelation, Q, QuerySet, Value
...
@@ -2,6 +2,7 @@ from django.db.models import FilteredRelation, Q, QuerySet, Value
from
django.db.models.aggregates
import
Count
,
Sum
from
django.db.models.aggregates
import
Count
,
Sum
from
django.utils.translation
import
gettext
as
_
from
django.utils.translation
import
gettext
as
_
from
aleksis.apps.chronos.models
import
LessonEvent
from
aleksis.apps.kolego.models
import
AbsenceReason
from
aleksis.apps.kolego.models
import
AbsenceReason
from
aleksis.core.models
import
Group
,
Person
,
SchoolTerm
from
aleksis.core.models
import
Group
,
Person
,
SchoolTerm
...
@@ -137,13 +138,6 @@ def annotate_person_statistics_for_school_term(
...
@@ -137,13 +138,6 @@ def annotate_person_statistics_for_school_term(
datetime_end__date__lte
=
school_term
.
date_end
,
datetime_end__date__lte
=
school_term
.
date_end
,
)
)
if
group
:
if
group
:
documentations
=
documentations
.
filter
(
lesson_events
=
LessonEvent
.
objects
.
filter
(
LessonEvent
.
objects
.
for_group_q
(
group
))
pk__in
=
Documentation
.
objects
.
filter
(
course__groups
=
group
)
documentations
=
documentations
.
filter
(
amends__in
=
lesson_events
)
.
values_list
(
"
pk
"
,
flat
=
True
)
.
union
(
Documentation
.
objects
.
filter
(
course__groups__parent_groups
=
group
).
values_list
(
"
pk
"
,
flat
=
True
)
)
)
return
annotate_person_statistics_from_documentations
(
persons
,
documentations
)
return
annotate_person_statistics_from_documentations
(
persons
,
documentations
)
This diff is collapsed.
Click to expand it.
aleksis/apps/alsijil/tasks.py
+
8
−
0
View file @
eae1c27b
...
@@ -7,6 +7,7 @@ from django.utils.translation import gettext as _
...
@@ -7,6 +7,7 @@ from django.utils.translation import gettext as _
from
celery.result
import
allow_join_result
from
celery.result
import
allow_join_result
from
celery.states
import
SUCCESS
from
celery.states
import
SUCCESS
from
aleksis.apps.chronos.models
import
LessonEvent
from
aleksis.apps.cursus.models
import
Course
from
aleksis.apps.cursus.models
import
Course
from
aleksis.apps.kolego.models.absence
import
AbsenceReason
from
aleksis.apps.kolego.models.absence
import
AbsenceReason
from
aleksis.core.models
import
Group
,
PDFFile
from
aleksis.core.models
import
Group
,
PDFFile
...
@@ -118,6 +119,13 @@ def generate_full_register_printout(
...
@@ -118,6 +119,13 @@ def generate_full_register_printout(
course__groups__parent_groups
=
group
course__groups__parent_groups
=
group
).
values_list
(
"
pk
"
,
flat
=
True
)
).
values_list
(
"
pk
"
,
flat
=
True
)
)
)
.
union
(
Documentation
.
objects
.
filter
(
amends__in
=
LessonEvent
.
objects
.
filter
(
LessonEvent
.
objects
.
for_group_q
(
group
)
)
).
values_list
(
"
pk
"
,
flat
=
True
)
)
)
)
)
)
...
...
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