[#2847] Added Deliverable#overhead_spent to calculate the overhead cost so far.
This commit is contained in:
26
lib/overhead_deliverable_patch.rb
Normal file
26
lib/overhead_deliverable_patch.rb
Normal 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
|
||||
Reference in New Issue
Block a user