#36 Quality checks

* adds unchecking/unrecording of interventions in case of post-check|post-record editing
This commit is contained in:
2021-10-25 17:39:39 +02:00
parent f6f532effb
commit d7bb2ef1dd
8 changed files with 137 additions and 44 deletions
+5 -5
View File
@@ -17,7 +17,7 @@ from codelist.settings import CODELIST_REGISTRATION_OFFICE_ID, CODELIST_CONSERVA
from intervention.managers import InterventionManager
from intervention.utils.quality import InterventionQualityChecker
from konova.models import BaseObject, Geometry, UuidModel, BaseResource, AbstractDocument, \
generate_document_file_upload_path, RecordableMixin
generate_document_file_upload_path, RecordableMixin, CheckableMixin
from konova.settings import DEFAULT_SRID_RLP, LANIS_LINK_TEMPLATE, LANIS_ZOOM_LUT
from konova.utils import generators
from user.models import UserActionLogEntry
@@ -171,7 +171,7 @@ class LegalData(UuidModel):
revocation = models.OneToOneField(Revocation, null=True, blank=True, help_text="Refers to 'Widerspruch am'", on_delete=models.SET_NULL)
class Intervention(BaseObject, RecordableMixin):
class Intervention(BaseObject, RecordableMixin, CheckableMixin):
"""
Interventions are e.g. construction sites where nature used to be.
"""
@@ -273,11 +273,11 @@ class Intervention(BaseObject, RecordableMixin):
"""
if self.identifier is None or len(self.identifier) == 0:
# No identifier given
# No identifier given by the user
self.identifier = self.generate_new_identifier()
# Before saving, make sure the set identifier is not used, yet
while Intervention.objects.filter(identifier=self.identifier).exists():
# Before saving, make sure the given identifier is not used in the meanwhile
while Intervention.objects.filter(identifier=self.identifier).exclude(id=self.id).exists():
self.identifier = self.generate_new_identifier()
super().save(*args, **kwargs)