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
Merge requests
!90
Performance optimizations
Code
Review changes
Check out branch
Download
Patches
Plain diff
Merged
Performance optimizations
feature/performance-optimizations
into
master
Overview
19
Commits
29
Pipelines
22
Changes
2
Merged
Jonathan Weth
requested to merge
feature/performance-optimizations
into
master
4 years ago
Overview
19
Commits
29
Pipelines
22
Changes
2
Expand
Close
#107 (closed)
Edited
4 years ago
by
Jonathan Weth
0
0
Merge request reports
Viewing commit
cbe2050b
Prev
Next
Show latest version
2 files
+
12
−
4
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
Files
2
Search (e.g. *.vue) (Ctrl+P)
Verified
cbe2050b
Optimize model extensions
· cbe2050b
Jonathan Weth
authored
4 years ago
aleksis/apps/alsijil/model_extensions.py
+
5
−
4
Options
from
datetime
import
date
from
typing
import
Dict
,
Optional
,
Union
from
typing
import
Dict
,
Optional
,
Union
,
Iterator
from
django.db.models
import
Exists
,
OuterRef
,
QuerySet
from
django.utils.translation
import
gettext
as
_
@@ -186,11 +186,12 @@ def get_or_create_lesson_documentation(
@LessonPeriod.method
def
get_absences
(
self
,
week
:
Optional
[
CalendarWeek
]
=
None
)
->
QuerySet
:
def
get_absences
(
self
,
week
:
Optional
[
CalendarWeek
]
=
None
)
->
Iterator
:
"""
Get all personal notes of absent persons for this lesson.
"""
if
not
week
:
week
=
self
.
week
return
self
.
personal_notes
.
filter
(
week
=
week
.
week
,
year
=
week
.
year
,
absent
=
True
)
return
filter
(
lambda
p
:
p
.
week
==
week
.
week
and
p
.
year
==
week
.
year
and
p
.
absent
,
self
.
personal_notes
.
all
())
@LessonPeriod.method
@@ -230,7 +231,7 @@ def get_extra_marks(
week
=
self
.
week
stats
=
{}
for
extra_mark
in
ExtraMark
.
objects
.
all
()
:
for
extra_mark
in
ExtraMark
.
all
:
qs
=
self
.
personal_notes
.
filter
(
week
=
week
.
week
,
year
=
week
.
year
,
extra_marks
=
extra_mark
)
Loading