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
50c74a95
Commit
50c74a95
authored
1 year ago
by
Felix Blanke
Browse files
Options
Downloads
Patches
Plain Diff
Handle fixed AKs
parent
a8ee67d9
No related branches found
No related tags found
1 merge request
!268
Merge fork for interoperability of KoMa solver
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
AKModel/models.py
+1
-1
1 addition, 1 deletion
AKModel/models.py
AKModel/views/ak.py
+21
-5
21 additions, 5 deletions
AKModel/views/ak.py
with
22 additions
and
6 deletions
AKModel/models.py
+
1
−
1
View file @
50c74a95
...
@@ -752,7 +752,7 @@ class AKSlot(models.Model):
...
@@ -752,7 +752,7 @@ class AKSlot(models.Model):
# check if ak resp. owner is available for the whole event
# check if ak resp. owner is available for the whole event
# -> no time constraint needs to be introduced
# -> no time constraint needs to be introduced
if
Availability
.
is_event_covered
(
self
.
event
,
self
.
ak
.
availabilities
.
all
()):
if
not
self
.
fixed
and
Availability
.
is_event_covered
(
self
.
event
,
self
.
ak
.
availabilities
.
all
()):
ak_time_constraints
=
[]
ak_time_constraints
=
[]
else
:
else
:
ak_time_constraints
=
[
f
"
availability-ak-
{
self
.
ak
.
pk
}
"
]
ak_time_constraints
=
[
f
"
availability-ak-
{
self
.
ak
.
pk
}
"
]
...
...
This diff is collapsed.
Click to expand it.
AKModel/views/ak.py
+
21
−
5
View file @
50c74a95
...
@@ -85,11 +85,27 @@ class AKJSONExportView(AdminViewMixin, FilterByEventSlugMixin, ListView):
...
@@ -85,11 +85,27 @@ class AKJSONExportView(AdminViewMixin, FilterByEventSlugMixin, ListView):
for
person
in
AKOwner
.
objects
.
filter
(
event
=
self
.
event
)
for
person
in
AKOwner
.
objects
.
filter
(
event
=
self
.
event
)
}
}
ak_fixed
=
{
ak
:
values
.
get
()
for
ak
in
ak_availabilities
.
keys
()
if
(
values
:
=
AKSlot
.
objects
.
select_related
().
filter
(
ak__pk
=
ak
,
fixed
=
True
)).
exists
()
}
def
_test_slot_contained
(
slot
:
Availability
,
availabilities
:
List
[
Availability
])
->
bool
:
return
any
(
availability
.
contains
(
slot
)
for
availability
in
availabilities
)
def
_test_event_covered
(
slot
:
Availability
,
availabilities
:
List
[
Availability
])
->
bool
:
return
not
Availability
.
is_event_covered
(
self
.
event
,
availabilities
)
def
_test_fixed_ak
(
ak
,
slot
)
->
bool
:
if
not
ak
in
ak_fixed
:
return
False
fixed_slot
=
Availability
(
self
.
event
,
start
=
ak_fixed
[
ak
].
start
,
end
=
ak_fixed
[
ak
].
end
)
return
fixed_slot
.
overlaps
(
slot
,
strict
=
True
)
def
_test_add_constraint
(
slot
:
Availability
,
availabilities
:
List
[
Availability
])
->
bool
:
def
_test_add_constraint
(
slot
:
Availability
,
availabilities
:
List
[
Availability
])
->
bool
:
return
(
return
_test_event_covered
(
slot
,
availabilities
)
and
_test_slot_contained
(
slot
,
availabilities
)
(
not
Availability
.
is_event_covered
(
self
.
event
,
availabilities
))
and
any
(
availability
.
contains
(
slot
)
for
availability
in
availabilities
)
)
for
block
in
self
.
event
.
time_slots
(
slots_in_an_hour
=
SLOTS_IN_AN_HOUR
):
for
block
in
self
.
event
.
time_slots
(
slots_in_an_hour
=
SLOTS_IN_AN_HOUR
):
current_block
=
[]
current_block
=
[]
...
@@ -103,7 +119,7 @@ class AKJSONExportView(AdminViewMixin, FilterByEventSlugMixin, ListView):
...
@@ -103,7 +119,7 @@ class AKJSONExportView(AdminViewMixin, FilterByEventSlugMixin, ListView):
constraints
.
append
(
"
resolution
"
)
constraints
.
append
(
"
resolution
"
)
for
ak
,
availabilities
in
ak_availabilities
.
items
():
for
ak
,
availabilities
in
ak_availabilities
.
items
():
if
_test_add_constraint
(
slot
,
availabilities
):
if
_test_add_constraint
(
slot
,
availabilities
)
or
_test_fixed_ak
(
ak
,
slot
)
:
constraints
.
append
(
f
"
availability-ak-
{
ak
}
"
)
constraints
.
append
(
f
"
availability-ak-
{
ak
}
"
)
for
person
,
availabilities
in
person_availabilities
.
items
():
for
person
,
availabilities
in
person_availabilities
.
items
():
...
...
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