Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
G
greg
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
it-bott-integrasjoner
greg
Commits
a7f58875
Commit
a7f58875
authored
3 years ago
by
Tore.Brede
Browse files
Options
Downloads
Patches
Plain Diff
Updating comment
parent
a159a556
No related branches found
No related tags found
1 merge request
!21
GREG-17: Duplicate check
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
greg/api/serializers/person.py
+9
-7
9 additions, 7 deletions
greg/api/serializers/person.py
with
9 additions
and
7 deletions
greg/api/serializers/person.py
+
9
−
7
View file @
a7f58875
...
...
@@ -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
)
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment