]> source.dussan.org Git - redmine.git/commitdiff
Call sort for array with more than one element only.
authorJean-Philippe Lang <jp_lang@yahoo.fr>
Sat, 29 Sep 2012 15:28:26 +0000 (15:28 +0000)
committerJean-Philippe Lang <jp_lang@yahoo.fr>
Sat, 29 Sep 2012 15:28:26 +0000 (15:28 +0000)
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@10519 e93f8b46-1217-0410-a6f0-8f06a7374b81

app/models/query.rb

index a3c66f90dedbffec04d4f3519c56172de5839844..357bad5a854cb5ab6b3571a8655d62c3de15e49e 100644 (file)
@@ -70,8 +70,8 @@ class QueryCustomFieldColumn < QueryColumn
   end
 
   def value(issue)
-    cv = issue.custom_values.select {|v| v.custom_field_id == @cf.id}.collect {|v| @cf.cast_value(v.value)}.sort {|a,b| a.to_s <=> b.to_s}
-    cv.size > 1 ? cv : cv.first
+    cv = issue.custom_values.select {|v| v.custom_field_id == @cf.id}.collect {|v| @cf.cast_value(v.value)}
+    cv.size > 1 ? cv.sort {|a,b| a.to_s <=> b.to_s} : cv.first
   end
 
   def css_classes