Skip to content

Commit

Permalink
modify sort query
Browse files Browse the repository at this point in the history
  • Loading branch information
pzupan committed Aug 29, 2019
1 parent 53747e1 commit eea7af4
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', ''), '.')::int[] 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 eea7af4

Please sign in to comment.