revenue improvements#373
Conversation
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository UI Review profile: ASSERTIVE Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
@Sahil-Gupta584 is attempting to deploy a commit to the Databuddy OSS Team on Vercel. A member of the Team first needs to authorize it. |
|
The latest updates on your projects. Learn more about Vercel for GitHub. 1 Skipped Deployment
|
Greptile SummaryThis PR improves the revenue dashboard by adding hourly granularity support, timezone-aware ClickHouse queries, a new "Total Revenue" stat card (replacing the Transactions card), a visitor-based conversion rate card, an improved Stripe webhook link, and dual Y-axes on the revenue chart. Key changes and issues found:
Confidence Score: 2/5Not safe to merge — two P1 logic bugs (duplicate chart metric and incorrect conversion rate formula) plus a debug log need to be fixed first. The duplicate "revenue" metric in REVENUE_METRICS will visually break the chart with two overlapping lines and a duplicate legend entry. The conversion rate will incorrectly show values above 100% for customers with multiple transactions. A debug console.log is also committed to production code. These are straightforward fixes but must be addressed before merging. revenue-chart.tsx (duplicate metric), revenue-content.tsx (console.log + conversion rate formula) Important Files Changed
Sequence DiagramsequenceDiagram
participant UI as RevenueContent
participant API as revenue_overview query
participant CH as ClickHouse
UI->>API: fetch(revenue_overview, {websiteId, startDate, endDate, timezone})
API->>CH: WITH revenue_attributed CTE + visitors CTE
CH-->>API: {total_revenue, total_transactions, unique_customers, ..., total_visitors}
API-->>UI: RevenueOverview[]
UI->>UI: compute visitors = overview.total_visitors
UI->>UI: compute conversionRate = (total_transactions / visitors) * 100
Note over UI: Should be unique_customers / visitors
UI->>API: fetch(revenue_time_series, {websiteId, startDate, endDate, timezone, granularity})
API->>CH: WITH base_revenue → revenue_agg (hour/day bucket)
CH-->>API: [{date, revenue, transactions, customers, ...}]
API-->>UI: RevenueTimeSeries[]
UI->>UI: padTimeSeriesData(data, start, end, defaults, granularity)
UI->>UI: map → chartData (revenue, transactions, avg_transaction, customers, refunds)
UI->>RevenueChart: data={chartData} granularity={dateRange.granularity}
Note over RevenueChart: revenue key rendered twice (duplicate metric)
Reviews (1): Last reviewed commit: "revenue improvements" | Re-trigger Greptile |
apps/dashboard/app/(main)/websites/[id]/revenue/_components/revenue-content.tsx
Outdated
Show resolved
Hide resolved
apps/dashboard/app/(main)/websites/[id]/revenue/_components/revenue-chart.tsx
Outdated
Show resolved
Hide resolved
apps/dashboard/app/(main)/websites/[id]/revenue/_components/revenue-content.tsx
Show resolved
Hide resolved
|
Hey Sahil, I noticed you committed directly to your main branch. For future PRs, could you create a feature branch first? Something like git checkout -b revenue-improvements, Then make your commits there and open the PR from that branch to main. This keeps the main branch clean and makes the history easier to manage. Thanks! |
Demo:
cursorful-video-1775420655042.1.2.mp4
Thinking of adding more payment providers support,
adding revenue bars on traffic trends graph of dashbaord, user can optionally render that. will be cool feat for taking ss