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.

filter for valid earnings only

Steven Teyd392759c3c20
diff --git a/apps/web/app/(ee)/api/partner-profile/referrals/route.ts b/apps/web/app/(ee)/api/partner-profile/referrals/route.ts
index 8cfd514285..3f0e0722c6 100644
--- a/apps/web/app/(ee)/api/partner-profile/referrals/route.ts
+++ b/apps/web/app/(ee)/api/partner-profile/referrals/route.ts
@@ -99,6 +99,7 @@ export const GET = withPartnerProfile(async ({ partner, searchParams }) => {
partnerId: partner.id,
programId: NETWORK_PROGRAM_ID,
type: CommissionType.referral,
+ status: { in: ["pending", "processed", "paid"] },
sourcePartnerId: {
in: referredPartners.map((p) => p.id),
},
diff --git a/apps/web/app/(ee)/api/partner-profile/referrals/stats/route.ts b/apps/web/app/(ee)/api/partner-profile/referrals/stats/route.ts
index 2807db06d1..06b692e665 100644
--- a/apps/web/app/(ee)/api/partner-profile/referrals/stats/route.ts
+++ b/apps/web/app/(ee)/api/partner-profile/referrals/stats/route.ts
@@ -28,6 +28,7 @@ export const GET = withPartnerProfile(async ({ partner }) => {
partnerId: partner.id,
programId: NETWORK_PROGRAM_ID,
type: CommissionType.referral,
+ status: { in: ["pending", "processed", "paid"] },
},
_sum: {
earnings: true,
diff --git a/apps/web/app/(ee)/api/partner-profile/referrals/timeseries/route.ts b/apps/web/app/(ee)/api/partner-profile/referrals/timeseries/route.ts
index 9d561963bc..3385c8ad7b 100644
--- a/apps/web/app/(ee)/api/partner-profile/referrals/timeseries/route.ts
+++ b/apps/web/app/(ee)/api/partner-profile/referrals/timeseries/route.ts
@@ -63,6 +63,7 @@ export const GET = withPartnerProfile(async ({ partner, searchParams }) => {
partnerId = ${partner.id}
AND programId = ${NETWORK_PROGRAM_ID}
AND type = ${CommissionType.referral}
+ AND status in ('pending', 'processed', 'paid')
AND createdAt >= ${startDate}
AND createdAt < ${endDate}
GROUP BY start