Skip to content

Commit

Permalink
Do not find duplicates on empty string
Browse files Browse the repository at this point in the history
  • Loading branch information
Ruben committed Feb 20, 2025
1 parent 7e812d2 commit 5402d3e
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,7 @@ export class RegistrationScopedRepository extends RegistrationScopedBaseReposito
)
.andWhere('attribute."duplicateCheck" = true')
.andWhere('duplicate."programId" = :programId', { programId })
.andWhere(`"attributeData1"."value" != ''`)
.orderBy('"attributeData1"."programRegistrationAttributeId"', 'ASC')
.limit(maxDuplicates)
.getRawMany();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -296,4 +296,24 @@ describe('Get duplicate status of registrations', () => {
isInScope: true,
});
});

it(`should not find duplicates on empty values`, async () => {
const registration1 = { ...registrationPV5 };
const registration2 = { ...registrationPV6 };

registration1.phoneNumber = '';
registration2.phoneNumber = '';
await importRegistrations(
programId,
[registration1, registration2],
accessToken,
);
const result = await getDuplicates({
programId,
accessToken,
referenceId: registration1.referenceId,
});
const duplicates = result.body;
expect(duplicates.length).toBe(0);
});
});

0 comments on commit 5402d3e

Please sign in to comment.