Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
AKPlanning
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
KIF
AKPlanning
Commits
555286f2
Commit
555286f2
authored
3 months ago
by
Felix Blanke
Browse files
Options
Downloads
Patches
Plain Diff
Rename private methods from '_test' to '_check'
parent
75bda450
No related branches found
No related tags found
1 merge request
!268
Merge fork for interoperability of KoMa solver
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
AKModel/models.py
+6
-6
6 additions, 6 deletions
AKModel/models.py
with
6 additions
and
6 deletions
AKModel/models.py
+
6
−
6
View file @
555286f2
...
...
@@ -522,11 +522,11 @@ class Event(models.Model):
# pylint: disable=import-outside-toplevel
from
AKModel.availability.models
import
Availability
def
_
test
_event_not_covered
(
availabilities
:
list
[
Availability
])
->
bool
:
def
_
check
_event_not_covered
(
availabilities
:
list
[
Availability
])
->
bool
:
"""
Test if event is not covered by availabilities.
"""
return
not
Availability
.
is_event_covered
(
self
,
availabilities
)
def
_
test
_akslot_fixed_in_timeslot
(
ak_slot
:
AKSlot
,
timeslot
:
Availability
)
->
bool
:
def
_
check
_akslot_fixed_in_timeslot
(
ak_slot
:
AKSlot
,
timeslot
:
Availability
)
->
bool
:
"""
Test if an AKSlot is fixed to overlap a timeslot slot.
"""
if
not
ak_slot
.
fixed
or
ak_slot
.
start
is
None
:
return
False
...
...
@@ -534,10 +534,10 @@ class Event(models.Model):
fixed_avail
=
Availability
(
event
=
self
,
start
=
ak_slot
.
start
,
end
=
ak_slot
.
end
)
return
fixed_avail
.
overlaps
(
timeslot
,
strict
=
True
)
def
_
test
_add_constraint
(
slot
:
Availability
,
availabilities
:
list
[
Availability
])
->
bool
:
def
_
check
_add_constraint
(
slot
:
Availability
,
availabilities
:
list
[
Availability
])
->
bool
:
"""
Test if object is not available for whole event and may happen during slot.
"""
return
(
_
test
_event_not_covered
(
availabilities
)
and
slot
.
is_covered
(
availabilities
)
_
check
_event_not_covered
(
availabilities
)
and
slot
.
is_covered
(
availabilities
)
)
def
_generate_time_constraints
(
...
...
@@ -549,7 +549,7 @@ class Event(models.Model):
return
[
f
"
{
prefix
}
-
{
avail_label
}
-
{
pk
}
"
for
pk
,
availabilities
in
avail_dict
.
items
()
if
_
test
_add_constraint
(
timeslot_avail
,
availabilities
)
if
_
check
_add_constraint
(
timeslot_avail
,
availabilities
)
]
timeslots
=
{
...
...
@@ -623,7 +623,7 @@ class Event(models.Model):
time_constraints
.
extend
([
f
"
fixed-akslot-
{
slot
.
id
}
"
for
slot
in
AKSlot
.
objects
.
filter
(
event
=
self
,
fixed
=
True
).
exclude
(
start__isnull
=
True
)
if
_
test
_akslot_fixed_in_timeslot
(
slot
,
timeslot
.
avail
)
if
_
check
_akslot_fixed_in_timeslot
(
slot
,
timeslot
.
avail
)
])
time_constraints
.
extend
(
timeslot
.
constraints
)
...
...
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