comparison app/models/version.rb @ 1517:dffacf8a6908 redmine-2.5

Update to Redmine SVN revision 13367 on 2.5-stable branch
author Chris Cannam
date Tue, 09 Sep 2014 09:29:00 +0100
parents e248c7af89ec
children
comparison
equal deleted inserted replaced
1516:b450a9d58aed 1517:dffacf8a6908
201 def self.fields_for_order_statement(table=nil) 201 def self.fields_for_order_statement(table=nil)
202 table ||= table_name 202 table ||= table_name
203 ["(CASE WHEN #{table}.effective_date IS NULL THEN 1 ELSE 0 END)", "#{table}.effective_date", "#{table}.name", "#{table}.id"] 203 ["(CASE WHEN #{table}.effective_date IS NULL THEN 1 ELSE 0 END)", "#{table}.effective_date", "#{table}.name", "#{table}.id"]
204 end 204 end
205 205
206 scope :sorted, order(fields_for_order_statement) 206 scope :sorted, lambda { order(fields_for_order_statement) }
207 207
208 # Returns the sharings that +user+ can set the version to 208 # Returns the sharings that +user+ can set the version to
209 def allowed_sharings(user = User.current) 209 def allowed_sharings(user = User.current)
210 VERSION_SHARINGS.select do |s| 210 VERSION_SHARINGS.select do |s|
211 if sharing == s 211 if sharing == s
230 230
231 def load_issue_counts 231 def load_issue_counts
232 unless @issue_count 232 unless @issue_count
233 @open_issues_count = 0 233 @open_issues_count = 0
234 @closed_issues_count = 0 234 @closed_issues_count = 0
235 fixed_issues.count(:all, :group => :status).each do |status, count| 235 fixed_issues.group(:status).count.each do |status, count|
236 if status.is_closed? 236 if status.is_closed?
237 @closed_issues_count += count 237 @closed_issues_count += count
238 else 238 else
239 @open_issues_count += count 239 @open_issues_count += count
240 end 240 end