Capped Featured Bounties to 2 and based on deadline.#1378
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
WalkthroughThe ChangesFeatured Listings Reordering
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes Poem
🚥 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 docstrings
🧪 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.
🧹 Nitpick comments (1)
src/features/listings/utils/reorderFeaturedOngoing.ts (1)
31-55: ⚡ Quick winConsider adding JSDoc documentation.
The function now implements three distinct behaviors (capping to 2, sorting by deadline, downgrading excess featured items) that are not immediately obvious from the function name alone. A brief JSDoc comment would help future maintainers understand the intended behavior without reading the implementation.
📝 Suggested JSDoc comment
+/** + * Reorders listings to promote up to 2 ongoing featured listings with the earliest deadlines. + * All listings are sorted by deadline. Ongoing featured listings beyond the limit are downgraded. + */ export function reorderFeaturedOngoing<T extends MinimalListing>( listings: T[], ): T[] {🤖 Prompt for 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. In `@src/features/listings/utils/reorderFeaturedOngoing.ts` around lines 31 - 55, Add a JSDoc block above the reorderFeaturedOngoing function documenting its behavior: state that reorderFeaturedOngoing<T extends MinimalListing>(listings: T[]): T[] sorts ongoing listings by deadline, promotes up to MAX_FEATURED_LISTINGS ongoing featured items to the front (preserving sorted order), and downgrades any additional ongoing featured items (sets isFeatured to false) before appending them; mention it relies on isOngoingListing and getDeadlineTime, note it returns a new array and does not mutate original listing objects except for the created downgraded copies, and include parameter and return type descriptions and a brief example of expected outcome.
🤖 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.
Nitpick comments:
In `@src/features/listings/utils/reorderFeaturedOngoing.ts`:
- Around line 31-55: Add a JSDoc block above the reorderFeaturedOngoing function
documenting its behavior: state that reorderFeaturedOngoing<T extends
MinimalListing>(listings: T[]): T[] sorts ongoing listings by deadline, promotes
up to MAX_FEATURED_LISTINGS ongoing featured items to the front (preserving
sorted order), and downgrades any additional ongoing featured items (sets
isFeatured to false) before appending them; mention it relies on
isOngoingListing and getDeadlineTime, note it returns a new array and does not
mutate original listing objects except for the created downgraded copies, and
include parameter and return type descriptions and a brief example of expected
outcome.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 93292372-04ec-4a82-b916-06cf8dcbcfbc
📒 Files selected for processing (1)
src/features/listings/utils/reorderFeaturedOngoing.ts
What does this PR do?
Where should the reviewer start?
How should this be manually tested?
Any background context you want to provide?
What are the relevant issues?
Screenshots (if appropriate)
Summary by CodeRabbit