HOTFIX: Quality checks
* fixes bug due to missing evaluation of compensation validity
This commit is contained in:
parent
e2d2e0317c
commit
6e31dfc00d
@ -481,11 +481,13 @@ class RecordModalForm(BaseModalForm):
|
||||
"confirm",
|
||||
msg
|
||||
)
|
||||
valid = checker.valid
|
||||
# Special case: Intervention
|
||||
# Add direct checks for related compensations
|
||||
if isinstance(self.instance, Intervention):
|
||||
self._are_compensations_valid()
|
||||
return super_val and checker.valid
|
||||
comps_valid = self._are_compensations_valid()
|
||||
valid = valid and comps_valid
|
||||
return super_val and valid
|
||||
|
||||
def _are_compensations_valid(self):
|
||||
""" Runs a special case for intervention-compensations validity
|
||||
@ -494,13 +496,16 @@ class RecordModalForm(BaseModalForm):
|
||||
|
||||
"""
|
||||
comps = self.instance.compensations.all()
|
||||
comps_valid = True
|
||||
for comp in comps:
|
||||
checker = comp.quality_check()
|
||||
comps_valid = comps_valid and checker.valid
|
||||
for msg in checker.messages:
|
||||
self.add_error(
|
||||
"confirm",
|
||||
f"{comp.identifier}: {msg}"
|
||||
)
|
||||
return comps_valid
|
||||
|
||||
def save(self):
|
||||
with transaction.atomic():
|
||||
|
Loading…
Reference in New Issue
Block a user