Created new function For referral users status count export report#770
Created new function For referral users status count export report#770Tusharmahajan12 wants to merge 5 commits into
Conversation
There was a problem hiding this comment.
Code Review
This pull request introduces a new referral summary endpoint (POST report/summary) to retrieve aggregated status counts per referral entity. Feedback highlights two critical issues: first, the new getReferralSummary method lacks pagination support, which could lead to performance degradation or OOM errors; second, changing the join type to LEFT JOIN globally in buildReportBase breaks the existing user-centric getReferralReport endpoint by returning empty user records. It is recommended to implement pagination for the summary endpoint and conditionally apply the LEFT JOIN using an internal flag.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
|
Warning Review limit reached
More reviews will be available in 29 minutes and 40 seconds. Learn how PR review limits work. Your organization has used up its prepaid credits, and credit purchases are no longer available. Enable the review add-on in the billing tab to keep reviews running — you're only billed for reviews past your plan's rate limits ($0.25/file). ⌛ How to resolve this issue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based credits. 🚦 How do rate limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan refill rate. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, the refill rate gradually slows as usage increases. The highest same-day bursts are limited more strictly. Please see our Fair Usage Limits Policy for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
WalkthroughAdds a ChangesReferral Summary Endpoint
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Possibly related PRs
Suggested reviewers
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ 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 |
There was a problem hiding this comment.
Actionable comments posted: 4
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@src/referrals/referrals.controller.ts`:
- Around line 133-137: The getSummary method in the referrals.controller.ts file
has Prettier formatting violations on lines 133, 136, and 137. Reformat the
method decorator block and method signature to comply with Prettier's line
length and formatting rules. The long description string in the ApiOkResponse
decorator on line 136 and the lengthy method signature with multiple parameters
on line 137 need to be reformatted, likely by breaking them across multiple
lines with appropriate indentation to stay within the configured line length
limit.
In `@src/referrals/referrals.service.ts`:
- Line 460: The changed lines in the referrals service contain Prettier
formatting violations that are being flagged by ESLint. Run Prettier on the
referrals.service.ts file to automatically format the code according to the
project's Prettier configuration. This includes the buildReportBase method call
on line 460 and the other specified lines (513, 553-557, 600, 623, 627, 642,
653, 656) which will be automatically reformatted to comply with Prettier
standards.
- Around line 570-576: The correlated subquery that selects tags using
ARRAY(SELECT DISTINCT UNNEST(u2."auto_tags") ...) from UserAttribution ua2 and
Users u2 is not applying the same cohort filter as the main aggregate query.
When filters.cohortIds is provided, add the equivalent cohort constraint to the
WHERE clause of this subquery to ensure tags are only collected from users
within the specified cohort, matching the scoping of the counts in the main
query.
- Line 486: The countSql query uses COUNT(*) which counts all rows including
duplicates and unattributed rows, causing the totalCount and hasMore values to
drift from the expected distinct user-count behavior. Replace COUNT(*) with
COUNT(DISTINCT user_id) in the countSql variable to ensure the count reflects
the actual number of distinct users rather than the total number of referral
rows.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: e3cbdb9e-411e-47e5-8888-abc2d881b6dc
📒 Files selected for processing (4)
src/common/utils/api-id.config.tssrc/common/utils/response.messages.tssrc/referrals/referrals.controller.tssrc/referrals/referrals.service.ts
|



Summary by CodeRabbit