[#4183] Implemented Contract#overhead_spent.

This commit is contained in:
Eric Davis
2010-07-13 13:27:06 -07:00
parent a9bae2e604
commit 7323537ea6
2 changed files with 39 additions and 1 deletions
+6 -1
View File
@@ -39,7 +39,6 @@ class Contract < ActiveRecord::Base
end
[:labor_spent,
:overhead_spent,
:total_spent,
:profit_spent
].each do |mthd|
@@ -56,6 +55,12 @@ class Contract < ActiveRecord::Base
deliverables.inject(0) {|total, deliverable| total += deliverable.overhead_budget_total }
end
# OPTIMIZE: N+1
# OPTIMIZE: also hits redmine_overhead which is known to be slow
def overhead_spent
deliverables.inject(0) {|total, deliverable| total += deliverable.overhead_spent }
end
# OPTIMIZE: N+1
def estimated_hour_budget
deliverables.inject(0) {|total, deliverable| total += deliverable.estimated_hour_budget_total }