comparison app/models/issue_status.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
30 30
31 scope :sorted, lambda { order("#{table_name}.position ASC") } 31 scope :sorted, lambda { order("#{table_name}.position ASC") }
32 scope :named, lambda {|arg| where("LOWER(#{table_name}.name) = LOWER(?)", arg.to_s.strip)} 32 scope :named, lambda {|arg| where("LOWER(#{table_name}.name) = LOWER(?)", arg.to_s.strip)}
33 33
34 def update_default 34 def update_default
35 IssueStatus.update_all({:is_default => false}, ['id <> ?', id]) if self.is_default? 35 IssueStatus.where(['id <> ?', id]).update_all({:is_default => false}) if self.is_default?
36 end 36 end
37 37
38 # Returns the default status for new issues 38 # Returns the default status for new issues
39 def self.default 39 def self.default
40 where(:is_default => true).first 40 where(:is_default => true).first
41 end 41 end
42 42
43 # Update all the +Issues+ setting their done_ratio to the value of their +IssueStatus+ 43 # Update all the +Issues+ setting their done_ratio to the value of their +IssueStatus+
44 def self.update_issue_done_ratios 44 def self.update_issue_done_ratios
45 if Issue.use_status_for_done_ratio? 45 if Issue.use_status_for_done_ratio?
46 IssueStatus.where("default_done_ratio >= 0").all.each do |status| 46 IssueStatus.where("default_done_ratio >= 0").each do |status|
47 Issue.update_all({:done_ratio => status.default_done_ratio}, {:status_id => status.id}) 47 Issue.where({:status_id => status.id}).update_all({:done_ratio => status.default_done_ratio})
48 end 48 end
49 end 49 end
50 50
51 return Issue.use_status_for_done_ratio? 51 return Issue.use_status_for_done_ratio?
52 end 52 end