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.

final changes

Steven Tey838910bcc007
diff --git a/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/analytics/page.tsx b/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/analytics/page.tsx
index 60a92a1034..fe5f1747b3 100644
--- a/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/analytics/page.tsx
+++ b/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/analytics/page.tsx
@@ -6,7 +6,14 @@ import { ProgramAnalyticsPageClient } from "./page-client";
export default function ProgramAnalytics() {
return (
- <PageContent title="Analytics">
+ <PageContent
+ title="Analytics"
+ titleInfo={{
+ title:
+ "Learn how to use Dub Analytics to track and measure your program's performance.",
+ href: "https://dub.co/help/article/program-analytics",
+ }}
+ >
<PageWidthWrapper>
<ProgramAnalyticsPageClient />
</PageWidthWrapper>
diff --git a/apps/web/scripts/combine-payouts.ts b/apps/web/scripts/partners/combine-payouts.ts
similarity index 84%
rename from apps/web/scripts/combine-payouts.ts
rename to apps/web/scripts/partners/combine-payouts.ts
index 7f076e763d..1aa91c943e 100644
--- a/apps/web/scripts/combine-payouts.ts
+++ b/apps/web/scripts/partners/combine-payouts.ts
@@ -1,14 +1,11 @@
import { prisma } from "@dub/prisma";
import "dotenv-flow/config";
-// A script to combine payouts for a partner
+// One time script to combine old payouts for a partner
async function main() {
- const programId = "prog_";
-
const pendingPayouts = await prisma.payout.groupBy({
by: ["programId", "partnerId"],
where: {
- programId,
status: "pending",
},
_count: {
@@ -75,22 +72,10 @@ async function main() {
},
});
- // Cancel the other payouts
- // Q: Should we delete them instead?
- await prisma.payout.updateMany({
- where: {
- id: {
- in: payoutsToCombine.slice(1).map((p) => p.id),
- },
- },
- data: {
- status: "canceled",
- description: `This payout was combined with payout ${combinedPayout.id}`,
- },
- });
+ console.log({ combinedPayout });
// Update all commissions to point to the new combined payout
- await prisma.commission.updateMany({
+ const commissions = await prisma.commission.updateMany({
where: {
payoutId: {
in: payoutsToCombine.map((p) => p.id),
@@ -100,6 +85,19 @@ async function main() {
payoutId: combinedPayout.id,
},
});
+
+ console.log({ commissions });
+
+ // Delete the old payouts
+ const deletedPayouts = await prisma.payout.deleteMany({
+ where: {
+ id: {
+ in: payoutsToCombine.slice(1).map((p) => p.id),
+ },
+ },
+ });
+
+ console.log({ deletedPayouts });
}
}