#132 WIP Minor change

* changed comment field string if conservation/registration office or handler not identifiable
This commit is contained in:
mpeltriaux 2022-05-12 12:07:24 +02:00
parent 3c211e6560
commit 06af30fc49

View File

@ -42,7 +42,8 @@ class InterventionMigrater(BaseMigrater):
intervention.responsible.registration_office = reg_office_code
self._migrate_responsible_code_to_team(intervention, reg_office_code, "ZB")
except ObjectDoesNotExist:
intervention.comment = f"{intervention.comment or ''}\nUnbekannte Zulassungsbehörde: {eiv_reg_off}"
intervention.responsible.registration_office = None
intervention.comment = f"{intervention.comment or ''}\nUneindeutige Zulassungsbehörde: {eiv_reg_off}"
intervention.responsible.registration_file_number = eiv_reg_file_num
if eiv_cons_off is not None and eiv_cons_off != 0:
@ -52,10 +53,11 @@ class InterventionMigrater(BaseMigrater):
is_leaf=True,
code_lists__in=[CODELIST_CONSERVATION_OFFICE_ID],
)
intervention.responsible.conservation_office = cons_office_code
self._migrate_responsible_code_to_team(intervention, cons_office_code, "ETS")
except ObjectDoesNotExist:
intervention.comment = f"{intervention.comment or ''}\nUnbekannte Eintragungsstelle: {eiv_cons_off}"
intervention.responsible.conservation_office = cons_office_code
intervention.responsible.conservation_office = None
intervention.comment = f"{intervention.comment or ''}\nUneindeutige Eintragungsstelle: '{eiv_cons_off}"
intervention.responsible.conservation_file_number = eiv_cons_file_num
if eiv_handler_type is not None and eiv_handler_type != 0:
@ -65,8 +67,12 @@ class InterventionMigrater(BaseMigrater):
is_leaf=True,
code_lists__in=[CODELIST_HANDLER_ID]
)
if not handler_type_code.is_leaf:
handler_type_code = cons_office_code.long_name
raise handler_type_code
intervention.responsible.handler.type = handler_type_code
except ObjectDoesNotExist:
intervention.responsible.handler.type = None
intervention.comment = f"{intervention.comment or ''}\nNicht migrierbarer Eingriffsverursacher_TYP: {eiv_handler_type}"
intervention.responsible.handler.detail = eiv_handler_detail
intervention.responsible.handler.save()