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.

Update backfill-link-data.ts

Steven Tey9aefbba3fa09
diff --git a/apps/web/lib/actions/partners/backfill-link-data.ts b/apps/web/lib/actions/partners/backfill-link-data.ts
index f3ad4e9815..81757c3c11 100644
--- a/apps/web/lib/actions/partners/backfill-link-data.ts
+++ b/apps/web/lib/actions/partners/backfill-link-data.ts
@@ -10,13 +10,14 @@ export const backfillLinkData = async ({
programEnrollmentId: string;
linkId: string;
}) => {
- const alreadyBackfilled = await prisma.sale.count({
+ const link = await prisma.link.findUniqueOrThrow({
where: {
- linkId,
+ id: linkId,
},
});
- if (alreadyBackfilled > 0) {
+ if (link.sales === 0) {
+ console.log(`Link ${linkId} has no sales, skipping backfill`);
return;
}