summaryrefslogtreecommitdiffstats
path: root/app
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2008-03-26 22:56:30 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2008-03-26 22:56:30 +0000
commitecc742f3ce33fdea03c5d163a58aa32b62fc2567 (patch)
tree15219857a97dcd265fb1aa1dd838bee970e5883a /app
parent7a434c902a7c91c7245e5978bc951cc6b4a813d9 (diff)
downloadredmine-ecc742f3ce33fdea03c5d163a58aa32b62fc2567.tar.gz
redmine-ecc742f3ce33fdea03c5d163a58aa32b62fc2567.zip
Make the versions with the same date sorted by name (#864).
git-svn-id: http://redmine.rubyforge.org/svn/trunk@1296 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app')
-rw-r--r--app/models/version.rb4
1 files changed, 2 insertions, 2 deletions
diff --git a/app/models/version.rb b/app/models/version.rb
index 183500485..dc618af0f 100644
--- a/app/models/version.rb
+++ b/app/models/version.rb
@@ -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