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
9d4f45f5
Verified
Commit
9d4f45f5
authored
3 years ago
by
Lloyd Meins
Browse files
Options
Downloads
Patches
Plain Diff
Do not show substitution on regular timetable
parent
db85b7a9
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!205
Resolve "Substitution is shown on regular/print timetable"
Pipeline
#37890
passed
3 years ago
Stage: test
Stage: build
Stage: publish
Stage: docker
Stage: deploy
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
aleksis/apps/chronos/managers.py
+13
-7
13 additions, 7 deletions
aleksis/apps/chronos/managers.py
aleksis/apps/chronos/util/build.py
+1
-1
1 addition, 1 deletion
aleksis/apps/chronos/util/build.py
with
14 additions
and
8 deletions
aleksis/apps/chronos/managers.py
+
13
−
7
View file @
9d4f45f5
...
...
@@ -319,7 +319,7 @@ class LessonDataQuerySet(models.QuerySet, WeekQuerySetMixin):
|
Q
(
**
{
self
.
_period_path
+
"
lesson__groups__parent_groups__in
"
:
groups
})
)
def
filter_teacher
(
self
,
teacher
:
Union
[
Person
,
int
]):
def
filter_teacher
(
self
,
teacher
:
Union
[
Person
,
int
]
,
is_smart
:
bool
=
True
):
"""
Filter for all lessons given by a certain teacher.
"""
qs1
=
self
.
filter
(
**
{
self
.
_period_path
+
"
lesson__teachers
"
:
teacher
})
qs2
=
self
.
filter
(
...
...
@@ -330,9 +330,12 @@ class LessonDataQuerySet(models.QuerySet, WeekQuerySetMixin):
}
)
return
qs1
.
union
(
qs2
)
if
is_smart
:
return
qs1
.
union
(
qs2
)
else
:
return
qs1
def
filter_room
(
self
,
room
:
Union
[
"
Room
"
,
int
]):
def
filter_room
(
self
,
room
:
Union
[
"
Room
"
,
int
]
,
is_smart
:
bool
=
True
):
"""
Filter for all lessons taking part in a certain room.
"""
qs1
=
self
.
filter
(
**
{
self
.
_period_path
+
"
room
"
:
room
})
qs2
=
self
.
filter
(
...
...
@@ -343,18 +346,21 @@ class LessonDataQuerySet(models.QuerySet, WeekQuerySetMixin):
}
)
return
qs1
.
union
(
qs2
)
if
is_smart
:
return
qs1
.
union
(
qs2
)
else
:
return
qs1
def
filter_from_type
(
self
,
type_
:
TimetableType
,
obj
:
Union
[
Person
,
Group
,
"
Room
"
,
int
]
self
,
type_
:
TimetableType
,
obj
:
Union
[
Person
,
Group
,
"
Room
"
,
int
]
,
is_smart
:
bool
=
True
)
->
Optional
[
models
.
QuerySet
]:
"""
Filter lesson data for a group, teacher or room by provided type.
"""
if
type_
==
TimetableType
.
GROUP
:
return
self
.
filter_group
(
obj
)
elif
type_
==
TimetableType
.
TEACHER
:
return
self
.
filter_teacher
(
obj
)
return
self
.
filter_teacher
(
obj
,
is_smart
=
is_smart
)
elif
type_
==
TimetableType
.
ROOM
:
return
self
.
filter_room
(
obj
)
return
self
.
filter_room
(
obj
,
is_smart
=
is_smart
)
else
:
return
None
...
...
This diff is collapsed.
Click to expand it.
aleksis/apps/chronos/util/build.py
+
1
−
1
View file @
9d4f45f5
...
...
@@ -76,7 +76,7 @@ def build_timetable(
if
is_person
:
lesson_periods
=
lesson_periods
.
filter_from_person
(
obj
)
else
:
lesson_periods
=
lesson_periods
.
filter_from_type
(
type_
,
obj
)
lesson_periods
=
lesson_periods
.
filter_from_type
(
type_
,
obj
,
is_smart
=
with_holidays
)
# Sort lesson periods in a dict
lesson_periods_per_period
=
lesson_periods
.
group_by_periods
(
is_week
=
is_week
)
...
...
This diff is collapsed.
Click to expand it.
Lloyd Meins
@lloydmeins
mentioned in commit
17f29ea3
·
3 years ago
mentioned in commit
17f29ea3
mentioned in commit 17f29ea3a9b19342f92e6263a8227070c5e58017
Toggle commit list
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