49 lines
1.4 KiB
Python
49 lines
1.4 KiB
Python
|
"""
|
||
|
Author: Michel Peltriaux
|
||
|
Organization: Struktur- und Genehmigungsdirektion Nord, Rhineland-Palatinate, Germany
|
||
|
Contact: michel.peltriaux@sgdnord.rlp.de
|
||
|
Created on: 25.10.21
|
||
|
|
||
|
"""
|
||
|
from django.utils.translation import gettext_lazy as _, pgettext_lazy as _con
|
||
|
from konova.utils.quality import AbstractQualityChecker
|
||
|
|
||
|
|
||
|
class CompensationQualityChecker(AbstractQualityChecker):
|
||
|
def run_check(self):
|
||
|
""" Perform all defined data checks
|
||
|
|
||
|
Returns:
|
||
|
|
||
|
"""
|
||
|
self._check_states()
|
||
|
self._check_actions()
|
||
|
self._check_geometry()
|
||
|
self.valid = len(self.messages) == 0
|
||
|
|
||
|
def _check_states(self):
|
||
|
""" Checks data quality for related CompensationState objects
|
||
|
|
||
|
Returns:
|
||
|
|
||
|
"""
|
||
|
after_states = self.obj.get_surface_after_states()
|
||
|
before_states = self.obj.get_surface_before_states()
|
||
|
if after_states != before_states:
|
||
|
self.messages.append(
|
||
|
_("States unequal")
|
||
|
)
|
||
|
if before_states == 0:
|
||
|
self._add_missing_attr_name(_("States before"))
|
||
|
if after_states == 0:
|
||
|
self._add_missing_attr_name(_("States after"))
|
||
|
|
||
|
def _check_actions(self):
|
||
|
""" Checks data quality for related CompensationState objects
|
||
|
|
||
|
Returns:
|
||
|
|
||
|
"""
|
||
|
if not self.obj.actions.all():
|
||
|
self._add_missing_attr_name(_con("Compensation", "Actions"))
|