Screenshots were not sorted correctly by version - fixed
This commit is contained in:
parent
b947de24f3
commit
197c0a8b10
1 changed files with 8 additions and 6 deletions
|
|
@ -48,14 +48,16 @@ class Package < ActiveRecord::Base
|
|||
end
|
||||
|
||||
def screenshots_sorted_by_version
|
||||
self.screenshots.sort do |x,y|
|
||||
self.screenshots.to_a.sort do |x,y|
|
||||
version_x = DebImporter::Version.new(x.version)
|
||||
version_y = DebImporter::Version.new(y.version)
|
||||
puts "x=#{version_x}"
|
||||
puts "y=#{version_y}"
|
||||
-1 if version_x<version_y
|
||||
1 if version_x>version_y
|
||||
0
|
||||
if version_x<version_y
|
||||
1
|
||||
elsif version_x>version_y
|
||||
-1
|
||||
else
|
||||
0
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue