Skip to content
This repository was archived by the owner on Mar 18, 2025. It is now read-only.

Commit 896c83b

Browse files
committed
Merge branch 'staging' into michalis-sanctions-validity-check-3
2 parents 3d038c0 + bbff727 commit 896c83b

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

packages/common/src/db/queries/CandidateUtils.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ export const filterCandidateInvalidityFields = (
1919
};
2020

2121
export const isCandidateInvaliditySet = (candidate: Candidate): boolean => {
22-
if (candidate.invalidityReasons.length == 0) {
22+
if (!candidate.invalidity?.length) {
2323
logger.warn(`No Candidate Invalidity data found for ${candidate.name}`);
2424
return false;
2525
}
@@ -33,13 +33,13 @@ export const setCandidateInvalidity = async (
3333
invalidityMessage = "",
3434
skipIfNoData = false, //TODO: understand if it's needed or not. Will says not necessary anymore, to be double checked. For now it maintains the previus behaviour.
3535
) => {
36+
if (skipIfNoData && !isCandidateInvaliditySet(candidate)) return;
37+
3638
const invalidityReasons = filterCandidateInvalidityFields(
3739
candidate,
3840
invalidityType,
3941
);
4042

41-
if (skipIfNoData && !isCandidateInvaliditySet(candidate)) return;
42-
4343
await CandidateModel.findOneAndUpdate(
4444
{
4545
slotId: candidate.slotId,

0 commit comments

Comments
 (0)