diff options
author | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2012-08-02 16:47:06 +0000 |
---|---|---|
committer | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2012-08-02 16:47:06 +0000 |
commit | 34cdac166949e5b88b3df36e5125fe4688339d18 (patch) | |
tree | b07ae6d6e3ccf58d31a3244bf3c0b7cd7e217c30 /app/models/version.rb | |
parent | c7b712067e86c4ddb591b883ee4584cf5e3aaaa2 (diff) | |
download | redmine-34cdac166949e5b88b3df36e5125fe4688339d18.tar.gz redmine-34cdac166949e5b88b3df36e5125fe4688339d18.zip |
Sort issues by scheduled versions first then unscheduled versions.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@10151 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/models/version.rb')
-rw-r--r-- | app/models/version.rb | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/app/models/version.rb b/app/models/version.rb index bb0e7ec42..0ea1c3c71 100644 --- a/app/models/version.rb +++ b/app/models/version.rb @@ -186,9 +186,11 @@ class Version < ActiveRecord::Base def self.fields_for_order_statement(table=nil) table ||= table_name - %w(effective_date name).map {|field| "#{table}.#{field}"} + ["(CASE WHEN #{table}.effective_date IS NULL THEN 1 ELSE 0 END)", "#{table}.effective_date", "#{table}.name", "#{table}.id"] end + scope :sorted, order(fields_for_order_statement) + # Returns the sharings that +user+ can set the version to def allowed_sharings(user = User.current) VERSION_SHARINGS.select do |s| |