Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
AlekSIS-App-Lesrooster
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
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®
Onboarding
AlekSIS-App-Lesrooster
Commits
1fc558bd
Commit
1fc558bd
authored
1 year ago
by
Julian
Browse files
Options
Downloads
Patches
Plain Diff
Filter groups for TimetableManagement by group of selected timeGrid
parent
fa81449b
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!29
Resolve "Switch validity range and group select"
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
aleksis/apps/lesrooster/schema/__init__.py
+15
-1
15 additions, 1 deletion
aleksis/apps/lesrooster/schema/__init__.py
with
15 additions
and
1 deletion
aleksis/apps/lesrooster/schema/__init__.py
+
15
−
1
View file @
1fc558bd
...
...
@@ -259,8 +259,22 @@ class Query(graphene.ObjectType):
if
not
info
.
context
.
user
.
has_perm
(
"
lesrooster.plan_timetables_rule
"
):
return
[]
# This will fail if the ID is invalid, but won't, if it is empty
time_grid_obj
:
TimeGrid
|
None
=
TimeGrid
.
objects
.
get
(
pk
=
time_grid
)
if
time_grid
is
not
None
else
None
# If there is no time_grid, or it is a generic one, filter groups to have a fitting school_term
if
time_grid_obj
is
None
or
time_grid_obj
.
group
is
None
:
return
(
Group
.
objects
.
filter
(
school_term__lr_validity_ranges__time_grids__id
=
time_grid
)
.
annotate
(
has_cg
=
Q
(
child_groups__isnull
=
False
))
.
order_by
(
"
-has_cg
"
,
"
name
"
)
)
group_id
=
time_grid_obj
.
group
.
pk
return
(
Group
.
objects
.
filter
(
school_term__lr_validity_ranges__time_grids__id
=
time_grid
)
Group
.
objects
.
filter
(
Q
(
pk
=
group_id
)
|
Q
(
parent_groups
=
group_id
)
|
Q
(
parent_groups__parent_groups
=
group_id
))
.
distinct
()
.
annotate
(
has_cg
=
Q
(
child_groups__isnull
=
False
))
.
order_by
(
"
-has_cg
"
,
"
name
"
)
)
...
...
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