Skip to content

Commit

Permalink
Merge pull request #215 from sensu/sort_version_numbers
Browse files Browse the repository at this point in the history
fix version sort order
  • Loading branch information
pzupan authored Aug 29, 2019
2 parents 199ef90 + eea7af4 commit 3d62baa
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion app/models/extension.rb
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ def self.total_download_count
def sorted_extension_versions
# ignore preceding 'V' and ignore 'master' so it sorts to end
# convert version to array of integers so 10.0.0 comes after 9.0.0
@sorted_extension_versions ||= extension_versions.order(Arel.sql("STRING_TO_ARRAY( REGEXP_REPLACE(extension_versions.version, E'V|v|master', ''), '.') DESC"))
@sorted_extension_versions ||= extension_versions.order(Arel.sql("STRING_TO_ARRAY( REGEXP_REPLACE(extension_versions.version, E'V|v|master|-(.*)', ''), '.')::int[] DESC"))
end

#
Expand Down

0 comments on commit 3d62baa

Please sign in to comment.