]> source.dussan.org Git - redmine.git/commitdiff
Make the versions with the same date sorted by name (#864).
authorJean-Philippe Lang <jp_lang@yahoo.fr>
Wed, 26 Mar 2008 22:56:30 +0000 (22:56 +0000)
committerJean-Philippe Lang <jp_lang@yahoo.fr>
Wed, 26 Mar 2008 22:56:30 +0000 (22:56 +0000)
git-svn-id: http://redmine.rubyforge.org/svn/trunk@1296 e93f8b46-1217-0410-a6f0-8f06a7374b81

app/models/version.rb

index 183500485716a86274e48ca1fc305b5500152400..dc618af0fa514c5118e9da7816f87e5c08367069 100644 (file)
@@ -89,11 +89,11 @@ class Version < ActiveRecord::Base
   
   def to_s; name end
   
-  # Versions are sorted by effective_date 
+  # Versions are sorted by effective_date and name
   # Those with no effective_date are at the end, sorted by name
   def <=>(version)
     if self.effective_date
-      version.effective_date ? (self.effective_date <=> version.effective_date) : -1
+      version.effective_date ? (self.effective_date == version.effective_date ? self.name <=> version.name : self.effective_date <=> version.effective_date) : -1
     else
       version.effective_date ? 1 : (self.name <=> version.name)
     end