From de3c637fbdb1f134ac1d98838bda39f6685ce957 Mon Sep 17 00:00:00 2001 From: Roberta Takenaka Date: Mon, 16 Feb 2026 13:43:35 -0300 Subject: [PATCH] =?UTF-8?q?Ajusta=20a=20atribui=C3=A7=C3=A3o=20de=20dados?= =?UTF-8?q?=20de=20pa=C3=ADs=20e=20de=20estado=20de=20institui=C3=A7=C3=B5?= =?UTF-8?q?es=20relacionadas=20ao=20journal?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- journal/models.py | 25 +++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/journal/models.py b/journal/models.py index dc853592..845f191b 100755 --- a/journal/models.py +++ b/journal/models.py @@ -1092,10 +1092,27 @@ def _add_institution_history( # Populate RawOrganizationMixin fields institution_history.raw_text = original_data institution_history.raw_institution_name = raw_institution_name - institution_history.raw_country_name = raw_country_name - institution_history.raw_country_code = raw_country_code - institution_history.raw_state_name = raw_state_name - institution_history.raw_state_acron = raw_state_acron + + if raw_country_code and raw_country_name: + institution_history.raw_country_name = raw_country_name + institution_history.raw_country_code = raw_country_code + elif raw_country_name or raw_country_code: + raw_country = raw_country_name or raw_country_code + if raw_country.upper() == raw_country and len(raw_country) == 2: + institution_history.raw_country_code = raw_country + else: + institution_history.raw_country_name = raw_country + + if raw_state_acron and raw_state_name: + institution_history.raw_state_name = raw_state_name + institution_history.raw_state_acron = raw_state_acron + elif raw_state_name or raw_state_acron: + raw_state = raw_state_name or raw_state_acron + if raw_state.upper() == raw_state and len(raw_state) == 2: + institution_history.raw_state_acron = raw_state + else: + institution_history.raw_state_name = raw_state + institution_history.raw_city_name = raw_city_name institution_history.save()