feat(member): include last finished summit sponsor memberships in getActiveSummitsSponsorMemberships#544
Conversation
|
Warning Rate limit exceeded
You’ve run out of usage credits. Purchase more in the billing tab. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughThe PR modifies ChangesSponsor Access Retention After Summit Ends
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Tip 💬 Introducing Slack Agent: The best way for teams to turn conversations into code.Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.
Built for teams:
One agent for your entire SDLC. Right inside Slack. 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 |
|
📘 OpenAPI / Swagger preview ➡️ https://OpenStackweb.github.io/summit-api/openapi/pr-544/ This page is automatically updated on each push to this PR. |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 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 `@app/Models/Foundation/Main/Member.php`:
- Around line 1858-1864: The subquery picking a single s2.ID can drop a summit
when multiple rows share the same latest past SummitEndDate; change the filter
to include all summits with the maximum past SummitEndDate instead of one
arbitrary ID. Replace the scalar subquery "AND s.ID = (SELECT s2.ID ... ORDER BY
s2.SummitEndDate DESC LIMIT 1)" with a condition that compares s.SummitEndDate
to the MAX(SummitEndDate) for summits before :now (e.g. using "s.SummitEndDate =
(SELECT MAX(s3.SummitEndDate) FROM Summit s3 WHERE s3.SummitEndDate < :now)" or
by using IN with a subquery that selects all s2.ID where s2.SummitEndDate = that
MAX). Update the SQL in Member.php where s.ID and SummitEndDate are referenced
to return all tied latest finished summits so sponsor access isn't lost.
🪄 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: defaults
Review profile: CHILL
Plan: Pro
Run ID: 369f404e-88aa-4a03-a0de-e5d6cb637bc5
📒 Files selected for processing (1)
app/Models/Foundation/Main/Member.php
| AND s.ID = ( | ||
| SELECT s2.ID | ||
| FROM Summit s2 | ||
| WHERE s2.SummitEndDate < :now | ||
| ORDER BY s2.SummitEndDate DESC | ||
| LIMIT 1 | ||
| ) |
There was a problem hiding this comment.
Handle ties for the latest finished summit.
This subquery picks a single Summit.ID, so if two summits share the same most recent past SummitEndDate, one is excluded arbitrarily. That drops sponsor access for one just-finished summit.
Suggested fix
- AND s.ID = (
- SELECT s2.ID
- FROM Summit s2
- WHERE s2.SummitEndDate < :now
- ORDER BY s2.SummitEndDate DESC
- LIMIT 1
- )
+ AND s.SummitEndDate = (
+ SELECT MAX(s2.SummitEndDate)
+ FROM Summit s2
+ WHERE s2.SummitEndDate < :now
+ )📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| AND s.ID = ( | |
| SELECT s2.ID | |
| FROM Summit s2 | |
| WHERE s2.SummitEndDate < :now | |
| ORDER BY s2.SummitEndDate DESC | |
| LIMIT 1 | |
| ) | |
| AND s.SummitEndDate = ( | |
| SELECT MAX(s2.SummitEndDate) | |
| FROM Summit s2 | |
| WHERE s2.SummitEndDate < :now | |
| ) |
🤖 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 `@app/Models/Foundation/Main/Member.php` around lines 1858 - 1864, The subquery
picking a single s2.ID can drop a summit when multiple rows share the same
latest past SummitEndDate; change the filter to include all summits with the
maximum past SummitEndDate instead of one arbitrary ID. Replace the scalar
subquery "AND s.ID = (SELECT s2.ID ... ORDER BY s2.SummitEndDate DESC LIMIT 1)"
with a condition that compares s.SummitEndDate to the MAX(SummitEndDate) for
summits before :now (e.g. using "s.SummitEndDate = (SELECT MAX(s3.SummitEndDate)
FROM Summit s3 WHERE s3.SummitEndDate < :now)" or by using IN with a subquery
that selects all s2.ID where s2.SummitEndDate = that MAX). Update the SQL in
Member.php where s.ID and SummitEndDate are referenced to return all tied latest
finished summits so sponsor access isn't lost.
…ActiveSummitsSponsorMemberships Signed-off-by: romanetar <roman_ag@hotmail.com>
2093df5 to
ed12524
Compare
|
📘 OpenAPI / Swagger preview ➡️ https://OpenStackweb.github.io/summit-api/openapi/pr-544/ This page is automatically updated on each push to this PR. |
ref https://app.clickup.com/t/86b9vzxfk
Summary by CodeRabbit