Skip to content

Commit 7116fb8

Browse files
committed
fix: filter excluded employees and check for Direct Deposit explicitly
Address Copilot review feedback: hasDirectDepositEmployees now filters out excluded employees and explicitly checks for 'Direct Deposit' rather than checking for != 'Check', avoiding false positives from historical or null payment methods. SDK-614 Made-with: Cursor
1 parent aefd866 commit 7116fb8

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

src/components/Payroll/helpers.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -605,10 +605,12 @@ export const getReimbursementCompensation = (
605605
}
606606

607607
export const hasDirectDepositEmployees = (
608-
employeeCompensations?: Array<{ paymentMethod?: string | null }>,
608+
employeeCompensations?: Array<{ paymentMethod?: string | null; excluded?: boolean }>,
609609
): boolean => {
610610
if (!employeeCompensations || employeeCompensations.length === 0) return true
611-
return employeeCompensations.some(comp => comp.paymentMethod !== 'Check')
611+
const activeCompensations = employeeCompensations.filter(comp => !comp.excluded)
612+
if (activeCompensations.length === 0) return true
613+
return activeCompensations.some(comp => comp.paymentMethod === 'Direct Deposit')
612614
}
613615

614616
// Total Payroll = Gross Pay + Employer Taxes + Reimbursements + Benefits

0 commit comments

Comments
 (0)