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.

limit maxDuration checks to sale rewards only

Steven Tey42302ba69a82
diff --git a/apps/web/lib/partners/create-partner-commission.ts b/apps/web/lib/partners/create-partner-commission.ts
index 86ef0e3e99..482981ca42 100644
--- a/apps/web/lib/partners/create-partner-commission.ts
+++ b/apps/web/lib/partners/create-partner-commission.ts
@@ -42,8 +42,8 @@ export const createPartnerCommission = async ({
return;
}
- // handle rewards with max duration limit
- if (typeof reward.maxDuration === "number") {
+ // handle sale rewards that have a max duration limit
+ if (reward.event === "sale" && typeof reward.maxDuration === "number") {
// Get the first commission (earliest sale) for this customer-partner pair
const firstCommission = await prisma.commission.findFirst({
where: {