From a7f58875fc00e70ef3d93bcb71fa024a302abc10 Mon Sep 17 00:00:00 2001 From: Tore Brede <Tore.Brede@uib.no> Date: Thu, 19 Aug 2021 08:51:46 +0200 Subject: [PATCH] Updating comment --- greg/api/serializers/person.py | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/greg/api/serializers/person.py b/greg/api/serializers/person.py index ad9c58a9..dad2f1b5 100644 --- a/greg/api/serializers/person.py +++ b/greg/api/serializers/person.py @@ -39,17 +39,19 @@ class PersonIdentitySerializer(serializers.ModelSerializer): fields = "__all__" def is_duplicate(self, identity_type: str, value: str) -> bool: - # If the type is other then it is allowed that two entries are the same, since - # the text may be some generic text added by the sponsor + # Guests may be verified using another unrecognised identification method, + # which the sponsor is required to elaborate in the value column. + # In this case we cannot assume the union of the identity type and + # the value to be unique across all records. if identity_type == PersonIdentity.IdentityType.OTHER: return False # If the type is a specific ID type, then duplicates are not expected return ( - len( - PersonIdentity.objects.filter(type__like=identity_type).filter( - value__like=value + len( + PersonIdentity.objects.filter(type__like=identity_type).filter( + value__like=value + ) ) - ) - > 0 + > 0 ) -- GitLab