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
4c705a68
Verified
Commit
4c705a68
authored
3 years ago
by
Jonathan Weth
Browse files
Options
Downloads
Patches
Plain Diff
Use distincts for affected querysets to prevent double entries
parent
19e342e6
No related branches found
No related tags found
1 merge request
!181
Resolve "Show abbreviations in the substitution plan only once"
Pipeline
#16065
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
CHANGELOG.rst
+8
-0
8 additions, 0 deletions
CHANGELOG.rst
aleksis/apps/chronos/managers.py
+13
-5
13 additions, 5 deletions
aleksis/apps/chronos/managers.py
with
21 additions
and
5 deletions
CHANGELOG.rst
+
8
−
0
View file @
4c705a68
...
...
@@ -6,6 +6,14 @@ All notable changes to this project will be documented in this file.
The format is based on `Keep a Changelog`_,
and this project adheres to `Semantic Versioning`_.
Unreleased
----------
Fixed
~~~~~
* Affected groups and persons in substitutions list were displayed multiple times.
`2.0b2` - 2021-06-02
--------------------
...
...
This diff is collapsed.
Click to expand it.
aleksis/apps/chronos/managers.py
+
13
−
5
View file @
4c705a68
...
...
@@ -545,7 +545,7 @@ class LessonSubstitutionQuerySet(LessonDataQuerySet):
"""
Return all lessons which are affected by selected substitutions.
"""
from
.models
import
Lesson
# noaq
return
Lesson
.
objects
.
filter
(
lesson_periods__substitutions__in
=
self
)
return
Lesson
.
objects
.
filter
(
lesson_periods__substitutions__in
=
self
)
.
distinct
()
def
affected_teachers
(
self
):
"""
Get affected teachers.
...
...
@@ -553,13 +553,21 @@ class LessonSubstitutionQuerySet(LessonDataQuerySet):
Return all teachers which are affected by
selected substitutions (as substituted or substituting).
"""
return
Person
.
objects
.
filter
(
Q
(
lessons_as_teacher__in
=
self
.
affected_lessons
())
|
Q
(
lesson_substitutions__in
=
self
)
).
order_by
(
"
short_name
"
)
return
(
Person
.
objects
.
filter
(
Q
(
lessons_as_teacher__in
=
self
.
affected_lessons
())
|
Q
(
lesson_substitutions__in
=
self
)
)
.
distinct
()
.
order_by
(
"
short_name
"
)
)
def
affected_groups
(
self
):
"""
Return all groups which are affected by selected substitutions.
"""
return
Group
.
objects
.
filter
(
lessons__in
=
self
.
affected_lessons
()).
order_by
(
"
short_name
"
)
return
(
Group
.
objects
.
filter
(
lessons__in
=
self
.
affected_lessons
())
.
distinct
()
.
order_by
(
"
short_name
"
)
)
class
DateRangeQuerySetMixin
:
...
...
This diff is collapsed.
Click to expand it.
Jonathan Weth
@hansegucker
mentioned in commit
02de7410
·
3 years ago
mentioned in commit
02de7410
mentioned in commit 02de74103cf7aa8c4030fbae3239cc591785dd5f
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