diff --git a/releases/unreleased/error-of-duplicated-identities-fixed-during-the-import.yml b/releases/unreleased/error-of-duplicated-identities-fixed-during-the-import.yml new file mode 100644 index 00000000..72d4bb83 --- /dev/null +++ b/releases/unreleased/error-of-duplicated-identities-fixed-during-the-import.yml @@ -0,0 +1,9 @@ +--- +title: Error of duplicated identities fixed during the import +category: fixed +author: Santiago DueƱas +issue: null +notes: > + Duplicated identities found during the import process + weren't property handled which made the process to + stop with an exception. diff --git a/sortinghat/core/importer/backend.py b/sortinghat/core/importer/backend.py index a418cc4c..33cee083 100644 --- a/sortinghat/core/importer/backend.py +++ b/sortinghat/core/importer/backend.py @@ -23,14 +23,14 @@ import sortinghat.core.importer.backends from grimoirelab_toolkit.introspect import inspect_signature_parameters -from .. import api, db +from .. import api from ..errors import (LoadError, InvalidValueError, AlreadyExistsError, NotFoundError, DuplicateRangeError) from ..importer.utils import find_backends -from ..models import MIN_PERIOD_DATE, MAX_PERIOD_DATE +from ..models import MIN_PERIOD_DATE, MAX_PERIOD_DATE, Identity logger = logging.getLogger(__name__) @@ -152,7 +152,10 @@ def __load_identities(self, identities): except InvalidValueError as e: logger.warning(str(e)) except AlreadyExistsError as e: - stored_identity = db.find_identity(e.eid) + stored_identity = Identity.objects.get(source=identity.source, + email=identity.email, + name=identity.name, + username=identity.username) stored_uuid = stored_identity.individual.mk if not uuid: