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
b6c5952e
Commit
b6c5952e
authored
9 months ago
by
Felix Blanke
Browse files
Options
Downloads
Patches
Plain Diff
Refactor
parent
6df70c28
No related branches found
No related tags found
1 merge request
!3
Merge into fork's `main` branch
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
AKModel/views/ak.py
+13
-13
13 additions, 13 deletions
AKModel/views/ak.py
with
13 additions
and
13 deletions
AKModel/views/ak.py
+
13
−
13
View file @
b6c5952e
...
...
@@ -86,9 +86,9 @@ class AKJSONExportView(AdminViewMixin, FilterByEventSlugMixin, ListView):
}
ak_fixed
=
{
ak
:
values
.
get
()
for
ak
in
ak_availabilities
.
keys
()
if
(
values
:
=
AKSlot
.
objects
.
select_related
().
filter
(
ak__pk
=
ak
,
fixed
=
True
)).
exists
()
ak
_id
:
values
.
get
()
for
ak
_id
in
ak_availabilities
.
keys
()
if
(
values
:
=
AKSlot
.
objects
.
select_related
().
filter
(
ak__pk
=
ak
_id
,
fixed
=
True
)).
exists
()
}
def
_test_slot_contained
(
slot
:
Availability
,
availabilities
:
List
[
Availability
])
->
bool
:
...
...
@@ -97,11 +97,11 @@ class AKJSONExportView(AdminViewMixin, FilterByEventSlugMixin, ListView):
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
:
def
_test_fixed_ak
(
ak
_id
,
slot
:
Availability
)
->
bool
:
if
not
ak
_id
in
ak_fixed
:
return
False
fixed_slot
=
Availability
(
self
.
event
,
start
=
ak_fixed
[
ak
].
start
,
end
=
ak_fixed
[
ak
].
end
)
fixed_slot
=
Availability
(
self
.
event
,
start
=
ak_fixed
[
ak
_id
].
start
,
end
=
ak_fixed
[
ak
_id
].
end
)
return
fixed_slot
.
overlaps
(
slot
,
strict
=
True
)
def
_test_add_constraint
(
slot
:
Availability
,
availabilities
:
List
[
Availability
])
->
bool
:
...
...
@@ -118,17 +118,17 @@ class AKJSONExportView(AdminViewMixin, FilterByEventSlugMixin, ListView):
if
self
.
event
.
reso_deadline
is
None
or
slot
.
end
<
self
.
event
.
reso_deadline
:
constraints
.
append
(
"
resolution
"
)
for
ak
,
availabilities
in
ak_availabilities
.
items
():
if
_test_add_constraint
(
slot
,
availabilities
)
or
_test_fixed_ak
(
ak
,
slot
):
constraints
.
append
(
f
"
availability-ak-
{
ak
}
"
)
for
ak
_id
,
availabilities
in
ak_availabilities
.
items
():
if
_test_add_constraint
(
slot
,
availabilities
)
or
_test_fixed_ak
(
ak
_id
,
slot
):
constraints
.
append
(
f
"
availability-ak-
{
ak
_id
}
"
)
for
person
,
availabilities
in
person_availabilities
.
items
():
for
person
_id
,
availabilities
in
person_availabilities
.
items
():
if
_test_add_constraint
(
slot
,
availabilities
):
constraints
.
append
(
f
"
availability-person-
{
person
}
"
)
constraints
.
append
(
f
"
availability-person-
{
person
_id
}
"
)
for
person
,
availabilities
in
room_availabilities
.
items
():
for
room_id
,
availabilities
in
room_availabilities
.
items
():
if
_test_add_constraint
(
slot
,
availabilities
):
constraints
.
append
(
f
"
availability-room-
{
room
}
"
)
constraints
.
append
(
f
"
availability-room-
{
room
_id
}
"
)
current_block
.
append
({
"
id
"
:
str
(
slot_index
),
...
...
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