Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
AlekSIS-App-Chronos
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-Chronos
Commits
055c5045
Verified
Commit
055c5045
authored
4 years ago
by
Jonathan Weth
Browse files
Options
Downloads
Patches
Plain Diff
Add missing imports
parent
a070ee6f
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
aleksis/apps/chronos/managers.py
+15
-2
15 additions, 2 deletions
aleksis/apps/chronos/managers.py
with
15 additions
and
2 deletions
aleksis/apps/chronos/managers.py
+
15
−
2
View file @
055c5045
from
datetime
import
date
,
timedelta
,
datetime
from
typing
import
Union
,
Optional
,
OrderedDict
from
aleksis.apps.chronos.util.date
import
week_weekday_from_date
from
calendarweek
import
CalendarWeek
from
django.db
import
models
from
django.db.models
import
F
,
Q
,
Count
from
django.http
import
QueryDict
from
aleksis.core.models
import
Person
,
Group
class
LessonPeriodManager
(
models
.
Manager
):
"""
Manager adding specific methods to lesson periods.
"""
...
...
@@ -117,7 +129,7 @@ class LessonDataQuerySet(models.QuerySet):
return
qs1
.
union
(
qs2
)
def
filter_room
(
self
,
room
:
Union
[
Room
,
int
]):
def
filter_room
(
self
,
room
:
Union
[
"
Room
"
,
int
]):
"""
Filter for all lessons taking part in a certain room.
"""
qs1
=
self
.
filter
(
**
{
self
.
_period_path
+
"
room
"
:
room
})
...
...
@@ -159,7 +171,7 @@ class LessonPeriodQuerySet(LessonDataQuerySet):
_period_path
=
""
_subst_path
=
"
substitutions__
"
def
next
(
self
,
reference
:
LessonPeriod
,
offset
:
Optional
[
int
]
=
1
)
->
LessonPeriod
:
def
next
(
self
,
reference
:
"
LessonPeriod
"
,
offset
:
Optional
[
int
]
=
1
)
->
"
LessonPeriod
"
:
"""
Get another lesson in an ordered set of lessons.
By default, it returns the next lesson in the set. By passing the offset argument,
...
...
@@ -246,6 +258,7 @@ class LessonSubstitutionQuerySet(LessonDataQuerySet):
def
affected_lessons
(
self
):
"""
Return all lessons which are affected by selected substitutions
"""
from
.models
import
Lesson
# noaq
return
Lesson
.
objects
.
filter
(
lesson_periods__substitutions__in
=
self
)
...
...
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