Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug/57550 custom field with format version are ordered as strings 2 #17005

Open
wants to merge 2 commits into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion app/models/queries/versions/orders/name_order.rb
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ def self.key
private

def order
ordered = Version.order_by_name
ordered = Version.order(:name)

if direction == :desc
ordered = ordered.reverse_order
Expand Down
2 changes: 0 additions & 2 deletions app/models/version.rb
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,6 @@ class Version < ApplicationRecord

scope :systemwide, -> { where(sharing: "system") }

scope :order_by_name, -> { order(Arel.sql("LOWER(#{Version.table_name}.name) ASC")) }

def self.with_status_open
where(status: "open")
end
Expand Down
2 changes: 1 addition & 1 deletion db/migrate/20240920152544_set_versions_name_collation.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
class SetVersionsNameCollation < ActiveRecord::Migration[7.1]
def up
execute <<-SQL.squish
CREATE COLLATION IF NOT EXISTS versions_name (provider = icu, locale = 'en-u-kn-true');
CREATE COLLATION IF NOT EXISTS versions_name (provider = icu, locale = 'und-u-kn-true');
SQL

change_column :versions, :name, :string, collation: "versions_name"
Expand Down
2 changes: 1 addition & 1 deletion modules/backlogs/app/models/backlog.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class Backlog
def self.owner_backlogs(project, options = {})
options.reverse_merge!(limit: nil)

backlogs = Sprint.apply_to(project).with_status_open.displayed_right(project).order_by_name
backlogs = Sprint.apply_to(project).with_status_open.displayed_right(project).order(:name)

stories_by_sprints = Story.backlogs(project.id, backlogs.map(&:id))

Expand Down