Skip to content

[AGILE-314] Order sprints on 'all sprints' by activity#24122

Merged
dombesz merged 2 commits into
release/17.6from
bug/agile-314-all-sprints-list-is-ordered-incorrectly
Jul 6, 2026
Merged

[AGILE-314] Order sprints on 'all sprints' by activity#24122
dombesz merged 2 commits into
release/17.6from
bug/agile-314-all-sprints-list-is-ordered-incorrectly

Conversation

@EinLama

@EinLama EinLama commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

Ticket

https://community.openproject.org/wp/AGILE-314

What are you trying to accomplish?

Order sprints on the all sprints page by activity.

What approach did you choose and why?

Introduced a new scope order_by_activity, it might be useful somewhere else (and it can be neatly unit-tested). The scope:

  1. orders by sprint status as required
  2. for sprints with the same status, sprint dates will be taken to decide which one to show first
  3. for sprints with the same status and dates, the sprint name will decide
  4. if even the names are the same, the database id will act as the final tie-breaker. In practice, this is unlikely to happen. But if it does, the order will be deterministic.

Merge checklist

  • Added/updated tests
  • Added/updated documentation in Lookbook (patterns, previews, etc)
  • Tested major browsers (Chrome, Firefox, Edge, ...)

... secondly, order by sprint dates and lastly by name
@EinLama EinLama force-pushed the bug/agile-314-all-sprints-list-is-ordered-incorrectly branch from 0324641 to e3be878 Compare July 6, 2026 11:21
@EinLama EinLama requested a review from Copilot July 6, 2026 11:21
@EinLama EinLama changed the base branch from dev to release/17.6 July 6, 2026 11:21
@opf opf deleted a comment from github-actions Bot Jul 6, 2026
@opf opf deleted a comment from github-actions Bot Jul 6, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds an “activity-based” ordering for Backlogs sprints on the All sprints page by introducing a dedicated Sprint.order_by_activity scope and switching the controller to use it.

Changes:

  • Introduces Sprint.order_by_activity to sort by status (active → in planning → completed), then by dates (descending), then by name.
  • Updates Backlogs::SprintsController#index to use the new ordering scope.
  • Adds unit coverage for the new scope and adjusts/extends feature coverage for the sprints index ordering & pagination expectations.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
modules/backlogs/app/models/sprints/scopes/order_by_activity.rb Adds new scope implementing activity-based ordering.
modules/backlogs/app/models/sprint.rb Registers the new order_by_activity scope on Sprint.
modules/backlogs/app/controllers/backlogs/sprints_controller.rb Switches sprints index ordering from date+name to activity-based ordering.
modules/backlogs/spec/models/sprints/scopes/order_by_activity_spec.rb Adds unit specs for the new ordering scope.
modules/backlogs/spec/features/backlogs/sprints/index_spec.rb Updates feature coverage for the new ordering and adjusts pagination expectations accordingly.

Comment thread modules/backlogs/app/models/sprints/scopes/order_by_activity.rb

@dombesz dombesz left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks and works great, thanks!

@dombesz dombesz merged commit fc38474 into release/17.6 Jul 6, 2026
14 of 15 checks passed
@dombesz dombesz deleted the bug/agile-314-all-sprints-list-is-ordered-incorrectly branch July 6, 2026 15:55
@github-actions github-actions Bot locked and limited conversation to collaborators Jul 6, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants