[#2847] Added Deliverable#overhead_spent to calculate the overhead cost so far.

This commit is contained in:
Eric Davis
2009-08-05 14:55:32 -07:00
parent 79847e36c0
commit cd826e7cd6
3 changed files with 70 additions and 0 deletions

View File

@@ -0,0 +1,26 @@
require_dependency 'deliverable'
module OverheadDeliverablePatch
def self.included(base)
base.send(:include, InstanceMethods)
base.class_eval do
unloadable
end
end
module InstanceMethods
# Cost of time logged to overhead activities
def overhead_spent
time_logs = issues.collect(&:time_entries).flatten
return time_logs.collect {|time_entry|
if time_entry.billable?
0
else
time_entry.cost
end
}.sum
end
end
end