Conversation
📝 WalkthroughWalkthroughAdds a bidirectional ManyToMany between SelectionPlan and PresentationCategoryGroup, a method to fetch presentations by selection-plan IDs, service logic to clear presentations' selection plans when disassociating tracks, and test updates to assert cleared selection plans. Changes
Sequence DiagramsequenceDiagram
participant Client
participant Service as PresentationCategoryGroupService
participant Category as PresentationCategory
participant Repo as DoctrineRepo
participant Presentation
Client->>Service: disassociateTrack2TrackGroup(groupId, trackId)
Service->>Category: getPresentationsBySelectionPlanIds(selectionPlanIds)
Category->>Repo: execute DQL (filter by category and selection_plan IN ids)
Repo-->>Category: presentations[]
Category-->>Service: presentations[]
loop for each presentation
Service->>Presentation: check other groups for same track
alt no other group covers track
Service->>Presentation: clearSelectionPlan()
Presentation-->>Service: selection plan cleared
else other group covers track
Presentation-->>Service: left intact
end
end
Service->>Service: removeCategory(track) from group
Service-->>Client: disassociation complete
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 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 |
|
📘 OpenAPI / Swagger preview ➡️ https://OpenStackweb.github.io/summit-api/openapi/pr-522/ 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 the current code and only fix it if needed.
Inline comments:
In `@app/Services/Model/Imp/PresentationCategoryGroupService.php`:
- Around line 255-261: Check whether the track is actually in the group first
using $track_group->hasCategory($track); only proceed to removeCategory($track)
when true, then fetch presentations by the selection plan ids and for each
presentation verify its current selection plan still contains the track (e.g.,
$presentation->getSelectionPlan()->hasTrack($track)); call
$presentation->clearSelectionPlan() only for presentations whose current plan no
longer has the track, and finally call $track_group->removeCategory($track) (or
call removeCategory before checking presentations if you prefer but still gate
the clearing by hasTrack on each presentation's current plan).
🪄 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: 9331089e-20a7-4123-9994-f1a4a80493de
📒 Files selected for processing (5)
app/Models/Foundation/Summit/Events/Presentations/PresentationCategory.phpapp/Models/Foundation/Summit/Events/Presentations/PresentationCategoryGroup.phpapp/Models/Foundation/Summit/SelectionPlan.phpapp/Services/Model/Imp/PresentationCategoryGroupService.phptests/oauth2/OAuth2TrackGroupsApiTest.php
…removed from a category group Signed-off-by: romanetar <roman_ag@hotmail.com>
f0235fc to
d2bd7d4
Compare
|
📘 OpenAPI / Swagger preview ➡️ https://OpenStackweb.github.io/summit-api/openapi/pr-522/ This page is automatically updated on each push to this PR. |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
app/Services/Model/Imp/PresentationCategoryGroupService.php (1)
265-270: Prefix unused parameter with underscore to suppress warning.The
$keyparameter is required by Doctrine'sexists()callback signature but is unused. Use$_or$_keyto signal intent.♻️ Suggested fix
- $track_reachable_via_another_group = $selection_plan->getCategoryGroups()->exists( - function ($key, $group) use ($track, $track_group) { + $track_reachable_via_another_group = $selection_plan->getCategoryGroups()->exists( + function ($_, $group) use ($track, $track_group) {🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@app/Services/Model/Imp/PresentationCategoryGroupService.php` around lines 265 - 270, The callback passed to selection_plan->getCategoryGroups()->exists is using an unused $key parameter which triggers a warning; rename it to $_ or $_key (e.g., change function ($key, $group) to function ($_key, $group) or function ($_ , $group)) to indicate it's intentionally unused and suppress the warning while keeping the existing logic that checks $group->getId() !== $track_group->getId() && $group->hasCategory($track->getId()).
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@app/Services/Model/Imp/PresentationCategoryGroupService.php`:
- Around line 265-270: The callback passed to
selection_plan->getCategoryGroups()->exists is using an unused $key parameter
which triggers a warning; rename it to $_ or $_key (e.g., change function ($key,
$group) to function ($_key, $group) or function ($_ , $group)) to indicate it's
intentionally unused and suppress the warning while keeping the existing logic
that checks $group->getId() !== $track_group->getId() &&
$group->hasCategory($track->getId()).
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 6aee6a81-9a01-4434-80fd-a70a7722c5f4
📒 Files selected for processing (5)
app/Models/Foundation/Summit/Events/Presentations/PresentationCategory.phpapp/Models/Foundation/Summit/Events/Presentations/PresentationCategoryGroup.phpapp/Models/Foundation/Summit/SelectionPlan.phpapp/Services/Model/Imp/PresentationCategoryGroupService.phptests/oauth2/OAuth2TrackGroupsApiTest.php
🚧 Files skipped from review as they are similar to previous changes (4)
- tests/oauth2/OAuth2TrackGroupsApiTest.php
- app/Models/Foundation/Summit/Events/Presentations/PresentationCategory.php
- app/Models/Foundation/Summit/SelectionPlan.php
- app/Models/Foundation/Summit/Events/Presentations/PresentationCategoryGroup.php
ref https://app.clickup.com/t/86b8rp3vh
Summary by CodeRabbit
Bug Fixes
Refactor
Tests