Skip to content

armgit / dub

Public Imported from GitHub
0

The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.

fix bug

Steven Tey8799a3eef051
diff --git a/apps/web/lib/partners/create-sales-payout.ts b/apps/web/lib/partners/create-sales-payout.ts
index d1ce371a03..08e975610b 100644
--- a/apps/web/lib/partners/create-sales-payout.ts
+++ b/apps/web/lib/partners/create-sales-payout.ts
@@ -39,8 +39,13 @@ export const createSalesPayout = async ({
return;
}
- const amount = sales.reduce((total, sale) => total + sale.earnings, 0);
const quantity = sales.length;
+ const amount = sales.reduce((total, sale) => total + sale.earnings, 0);
+
+ if (amount === 0) {
+ return; // No payout if sale amount is 0
+ }
+
let payout: Payout | null = null;
// Check if the partner has another pending payout