Skip to content
Snippets Groups Projects
Commit a7f58875 authored by Tore.Brede's avatar Tore.Brede
Browse files

Updating comment

parent a159a556
No related branches found
No related tags found
1 merge request!21GREG-17: Duplicate check
......@@ -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
)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment