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
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
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Felix Blanke
AKPlanning
Commits
20ab6461
Commit
20ab6461
authored
10 months ago
by
Felix Blanke
Browse files
Options
Downloads
Patches
Plain Diff
Handle fixed AKs
parent
32e7ee94
Branches
Branches containing commit
No related tags found
1 merge request
!3
Merge into fork's `main` branch
Changes
2
Hide 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 @
20ab6461
...
...
@@ -698,7 +698,7 @@ class AKSlot(models.Model):
# check if ak resp. owner is available for the whole event
# -> 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
=
[]
else
:
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 @
20ab6461
...
...
@@ -85,11 +85,27 @@ class AKJSONExportView(AdminViewMixin, FilterByEventSlugMixin, ListView):
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
:
return
(
(
not
Availability
.
is_event_covered
(
self
.
event
,
availabilities
))
and
any
(
availability
.
contains
(
slot
)
for
availability
in
availabilities
)
)
return
_test_event_covered
(
slot
,
availabilities
)
and
_test_slot_contained
(
slot
,
availabilities
)
for
block
in
self
.
event
.
time_slots
(
slots_in_an_hour
=
SLOTS_IN_AN_HOUR
):
current_block
=
[]
...
...
@@ -103,7 +119,7 @@ class AKJSONExportView(AdminViewMixin, FilterByEventSlugMixin, ListView):
constraints
.
append
(
"
resolution
"
)
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
}
"
)
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