Bug/74773 closed work packages are still considered to be part of the bucket#23302
Open
dombesz wants to merge 4 commits into
Open
Bug/74773 closed work packages are still considered to be part of the bucket#23302dombesz wants to merge 4 commits into
dombesz wants to merge 4 commits into
Conversation
6 tasks
…bucket. https://community.openproject.org/wp/74773 Add backlog neighbours scope Use the with_backlogs_neighbours in the work package card menu.
46c7de1 to
771a3d5
Compare
Contributor
There was a problem hiding this comment.
Pull request overview
This PR addresses incorrect move up/down behavior in Backlogs lists when some work packages are excluded (e.g., closed statuses or excluded types), by switching from position-based logic to neighbor-ID-based logic computed from the actually displayed scope.
Changes:
- Add a
with_backlogs_neighboursscope that computesprev_prev_id,prev_id, andnext_idat the database level using window functions. - Update the Backlogs work package card menu to determine first/last items via neighbor IDs (and remove the
max_positionargument). - Extend/update specs to cover neighbor computation and the new move menu behavior.
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| modules/backlogs/app/models/work_packages/scopes/with_backlogs_neighbours.rb | Introduces the window-function-based neighbor ID scope used to drive move actions. |
| modules/backlogs/lib/open_project/backlogs/patches/work_package_patch.rb | Registers the new scope on WorkPackage within the Backlogs patch. |
| modules/backlogs/app/controllers/backlogs/work_packages_controller.rb | Loads the menu work package enriched with neighbor IDs; ensures base query is ordered by position. |
| modules/backlogs/app/components/backlogs/work_package_card_menu_component.rb | Removes max_position and switches move/first/last logic to neighbor IDs + prev_id-based moves. |
| modules/backlogs/spec/models/work_packages/scopes/with_backlogs_neighbours_spec.rb | Adds unit coverage for correct neighbor IDs under different filtered scopes. |
| modules/backlogs/spec/components/backlogs/work_package_card_menu_component_spec.rb | Updates component specs to validate move menu behavior and submitted params based on neighbor IDs. |
| modules/backlogs/lib/open_project/backlogs/patches/project_patch.rb | Removes redundant manual include (engine patching handles inclusion). |
| modules/backlogs/lib/open_project/backlogs/patches/permitted_params_patch.rb | Adds frozen_string_literal: true and removes redundant manual include. |
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
…h the default order of acts_as_list.
0143179 to
b2fe43f
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Note
This is a remake of an accidentally merged PR #23295
Ticket
https://community.openproject.org/wp/74773
What are you trying to accomplish?
Not consider excluded work packages from the list when moving a work package up or down on the list.
What approach did you choose and why?
prev_idinstead of the position when rendering move up/down menu items. Position was unreliable, because we do exclude items from the list for example, closed work packages and excluded work package types. This feature will also enable us to render move up/down buttons with correct actions when filtering of work packages will be implemented in the sprints page.prev_prev_id,prev_idandnext_idon the database level. So each filtered work package scope can have its own neighbouring ids included. This is required for rendering the correctprev_idfor move up/down actions.max_positionfrom the menu component argument. Rely on theprev_id,next_idinstead in thefirst_item?,last_item?methods.Merge checklist