Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
LOFAR
Manage
Activity
Members
Labels
Plan
Issues
Wiki
Jira issues
Open Jira
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Code review analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
RadioObservatory
LOFAR
Commits
b245dfe4
Commit
b245dfe4
authored
3 years ago
by
Jörn Künsemöller
Browse files
Options
Downloads
Patches
Plain Diff
TMSS-605
: filter for overlap of reservation and SUB times
parent
0d297556
No related branches found
No related tags found
2 merge requests
!634
WIP: COBALT commissioning delta
,
!624
TMSS-605: Add check for stations in use when saving reservation, and fix...
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
SAS/TMSS/backend/src/tmss/tmssapp/models/specification.py
+9
-3
9 additions, 3 deletions
SAS/TMSS/backend/src/tmss/tmssapp/models/specification.py
with
9 additions
and
3 deletions
SAS/TMSS/backend/src/tmss/tmssapp/models/specification.py
+
9
−
3
View file @
b245dfe4
...
...
@@ -1435,10 +1435,16 @@ class Reservation(NamedCommon, TemplateSchemaMixin):
return
None
def
_prevent_reserving_stations_that_are_used_in_active_units
(
self
):
# todo: we cannot filter for status in SQL because is a property, find a way to reduce the queryset reasonably
# todo: filter for the time range of the reservation?
# Determine active scheduling units that overlap in time with the reservation
# Note: we cannot filter for status and on sky times in SQL because these are properties
# todo: find a way to reduce the initial queryset reasonably
subs
=
SchedulingUnitBlueprint
.
objects
.
all
()
active_subs
=
[
x
for
x
in
subs
if
x
.
status
in
[
SchedulingUnitBlueprint
.
Status
.
OBSERVING
.
value
,
SchedulingUnitBlueprint
.
Status
.
SCHEDULED
.
value
]]
active_subs
=
[
x
for
x
in
subs
if
(
x
.
status
in
[
SchedulingUnitBlueprint
.
Status
.
OBSERVING
.
value
,
SchedulingUnitBlueprint
.
Status
.
SCHEDULED
.
value
]
and
x
.
scheduled_on_sky_stop_time
>=
self
.
start_time
)]
if
self
.
stop_time
:
active_subs
=
[
x
for
x
in
active_subs
if
self
.
scheduled_on_sky_start_time
<=
self
.
stop_time
]
# Raise an exception if any of these scheduling units uses a station that shall be reserved
if
"
resources
"
in
self
.
specifications_doc
and
"
stations
"
in
self
.
specifications_doc
[
"
resources
"
]:
stations_to_reserve
=
self
.
specifications_doc
[
'
resources
'
][
'
stations
'
]
for
sub
in
active_subs
:
...
...
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