Conversation
* fix: Fix proposal order when ids are multi-matching (133 -> 1133) * fix: Test failing --------- Co-authored-by: moustachu <moustachu@opensourcepolitics.eu>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR refines proposals ordering in the proposals index by switching to a PostgreSQL array_position-based ordering and adding a deterministic tiebreaker for equal ordering values, while also adding Slovak locale strings and adjusting controller extension loading/precedence.
Changes:
- Replace
position(... in ...)ordering witharray_position(ARRAY[...] ...)to keep proposals ordered by a specific ID list. - Add a
reordertiebreaker (id DESC) via a prepended controller module for stable ordering. - Add Slovak (
sk) locale entries for assemblies and date/time UI strings.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
spec/controllers/proposals_controller_spec.rb |
Updates controller spec expectation to match new array_position SQL ordering. |
lib/extends/controllers/decidim/proposals/proposals_controller_reorder_extends.rb |
Adds a prepended reorder override to append id DESC as a deterministic tiebreaker. |
lib/extends/controllers/decidim/proposals/proposals_controller_extends.rb |
Switches ordering SQL to array_position and changes extension application from include to prepend. |
config/locales/sk.yml |
Introduces Slovak locale keys for assemblies and date/time-related UI text. |
config/application.rb |
Requires the new proposals reorder extension during after_initialize. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
AyakorK
approved these changes
Jul 24, 2026
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.
This pull request introduces improvements to proposal ordering logic, adds Slovak locale translations, and refines the way controller extensions are included in the codebase. The main focus is on enhancing the ordering of proposals and making the code more maintainable and extensible.
Proposal ordering improvements:
ProposalsControllerReorderTiebreakerinproposals_controller_reorder_extends.rbto ensure proposals with the same ordering are consistently sorted by descendingidas a tiebreaker. This module is prepended to the controller for higher priority. [1] [2]proposals_controller_extends.rbfrom usingposition(... in ...)toarray_position, which is more efficient and compatible with PostgreSQL for ordering proposals by a specific list of IDs.proposals_controller_spec.rbto match the new ordering logic usingarray_position.Codebase maintainability:
includetoprependforProposalsControllerExtends, ensuring that custom logic takes precedence over the original methods.Localization:
sk) translations for assemblies and date/time formats insk.yml, improving internationalization support.