diff --git a/studio/schemas/objects/compensations/bonusesByLocation.ts b/studio/schemas/objects/compensations/bonusesByLocation.ts index 3b409f421..e88ba53f3 100644 --- a/studio/schemas/objects/compensations/bonusesByLocation.ts +++ b/studio/schemas/objects/compensations/bonusesByLocation.ts @@ -54,10 +54,11 @@ export const bonusesByLocation = defineField({ ], validation: (Rule) => Rule.custom((bonusesByLocation) => { + const isNotDuplicate: boolean = checkForDuplicateLocations( + bonusesByLocation as DocumentWithLocation[] | undefined, + ); return ( - checkForDuplicateLocations( - bonusesByLocation as DocumentWithLocation[] | undefined, - ) || + isNotDuplicate || "Each location should be listed only once in the bonuses list. You can assign the same bonus amount to multiple locations, but make sure no location appears more than once." ); }), diff --git a/studio/schemas/objects/compensations/salariesByLocation.ts b/studio/schemas/objects/compensations/salariesByLocation.ts index 1a20823c8..7aa9f8efe 100644 --- a/studio/schemas/objects/compensations/salariesByLocation.ts +++ b/studio/schemas/objects/compensations/salariesByLocation.ts @@ -76,10 +76,11 @@ export const salariesByLocation = defineField({ ], validation: (Rule) => Rule.custom((salariesByLocation) => { + const isNotDuplicate: boolean = checkForDuplicateLocations( + salariesByLocation as DocumentWithLocation[] | undefined, + ); return ( - checkForDuplicateLocations( - salariesByLocation as DocumentWithLocation[] | undefined, - ) || + isNotDuplicate || "Each location should be listed only once in the salaries list. You can assign the same salary data to multiple locations, but make sure no location appears more than once." ); }),