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
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
KIF
AKPlanning
Commits
b963f1a1
Commit
b963f1a1
authored
3 years ago
by
Benjamin Hättasch
Browse files
Options
Downloads
Patches
Plain Diff
Make sure corresponding CVs are deleted if reso_deadline is nulled
parent
f58af423
No related branches found
Branches containing commit
No related tags found
1 merge request
!110
Implement additional constraint validation checks
Pipeline
#48593
failed
3 years ago
Stage: test
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
AKScheduling/models.py
+9
-2
9 additions, 2 deletions
AKScheduling/models.py
with
9 additions
and
2 deletions
AKScheduling/models.py
+
9
−
2
View file @
b963f1a1
...
@@ -44,6 +44,8 @@ def update_cv_reso_deadline_for_slot(slot):
...
@@ -44,6 +44,8 @@ def update_cv_reso_deadline_for_slot(slot):
"""
"""
event
=
slot
.
event
event
=
slot
.
event
if
slot
.
ak
.
reso
and
slot
.
event
.
reso_deadline
and
slot
.
start
:
if
slot
.
ak
.
reso
and
slot
.
event
.
reso_deadline
and
slot
.
start
:
# Update only if reso_deadline exists
# if event was changed and reso_deadline is removed, CVs will be deleted by event changed handler
violation_type
=
ConstraintViolation
.
ViolationType
.
AK_AFTER_RESODEADLINE
violation_type
=
ConstraintViolation
.
ViolationType
.
AK_AFTER_RESODEADLINE
new_violations
=
[]
new_violations
=
[]
if
slot
.
end
>
event
.
reso_deadline
:
if
slot
.
end
>
event
.
reso_deadline
:
...
@@ -612,7 +614,7 @@ def availability_changed_handler(sender, instance: Availability, **kwargs):
...
@@ -612,7 +614,7 @@ def availability_changed_handler(sender, instance: Availability, **kwargs):
c
.
ak_slots_tmp
.
add
(
slot
)
c
.
ak_slots_tmp
.
add
(
slot
)
new_violations
.
append
(
c
)
new_violations
.
append
(
c
)
print
(
f
"
{
instance
.
ak
}
has the following slots
p
utside availabilities:
{
new_violations
}
"
)
print
(
f
"
{
instance
.
ak
}
has the following slots
o
utside availabilities:
{
new_violations
}
"
)
# ... and compare to/update list of existing violations of this type
# ... and compare to/update list of existing violations of this type
# belonging to the AK that was recently changed (important!)
# belonging to the AK that was recently changed (important!)
...
@@ -622,8 +624,13 @@ def availability_changed_handler(sender, instance: Availability, **kwargs):
...
@@ -622,8 +624,13 @@ def availability_changed_handler(sender, instance: Availability, **kwargs):
@receiver
(
post_save
,
sender
=
Event
)
@receiver
(
post_save
,
sender
=
Event
)
def
event_changed_handler
(
sender
,
instance
,
**
kwargs
):
def
event_changed_handler
(
sender
,
instance
:
Event
,
**
kwargs
):
# == Check for reso ak after reso deadline (which might have changed) ==
# == Check for reso ak after reso deadline (which might have changed) ==
if
instance
.
reso_deadline
:
if
instance
.
reso_deadline
:
for
slot
in
instance
.
akslot_set
.
filter
(
start__isnull
=
False
,
ak__reso
=
True
):
for
slot
in
instance
.
akslot_set
.
filter
(
start__isnull
=
False
,
ak__reso
=
True
):
update_cv_reso_deadline_for_slot
(
slot
)
update_cv_reso_deadline_for_slot
(
slot
)
else
:
# No reso deadline, delete all violations
violation_type
=
ConstraintViolation
.
ViolationType
.
AK_AFTER_RESODEADLINE
existing_violations_to_check
=
list
(
instance
.
constraintviolation_set
.
filter
(
type
=
violation_type
))
update_constraint_violations
([],
existing_violations_to_check
)
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