diff --git a/konova/management/commands/repair_old_entries_trier_saarburg.py b/konova/management/commands/repair_old_entries_trier_saarburg.py index e269bda0..26ec5881 100644 --- a/konova/management/commands/repair_old_entries_trier_saarburg.py +++ b/konova/management/commands/repair_old_entries_trier_saarburg.py @@ -32,6 +32,8 @@ class Command(BaseKonovaCommand): for entry in self.interventions: self._write_warning(f"{entry.identifier};{entry.responsible.registration_file_number}; {entry.responsible.registration_office}, {list(entry.legal.laws.all())}") + #self.repair() + def get_law(self): """ Returns the expected law (LBauO; id=1935994) @@ -93,6 +95,7 @@ class Command(BaseKonovaCommand): for entry in interventions: self._repair_laws(entry) self._repair_registration_office(entry) + self._repair_recording(entry) def _repair_laws(self, entry): """ Fixes missing law @@ -103,13 +106,12 @@ class Command(BaseKonovaCommand): correct_law = self.get_law() laws = entry.legal.laws.all() if correct_law not in laws: - laws.add(correct_law) + entry.legal.laws.add(correct_law) def _repair_registration_office(self, entry): """ Fixes missing registration office """ - assert entry.responsible.registration_office is None reg_office = self.get_registration_office() entry.responsible.registration_office = reg_office @@ -144,4 +146,5 @@ class Command(BaseKonovaCommand): coms_valid = False if coms_valid and intervention_valid: + self._write_success(f" {entry.identifier} recorded!") entry.set_recorded(user=user)