[#4552] Add the Labor hours spent to the Deliverable details
This commit is contained in:
@@ -86,6 +86,11 @@ class Deliverable < ActiveRecord::Base
|
||||
(overhead_budgets.sum(:hours) || 0.0)
|
||||
end
|
||||
|
||||
# OPTIMIZE: N+1
|
||||
def labor_hours_spent_total(date=nil)
|
||||
issues.inject(0) {|total, issue| total += issue.billable_time_spent } # From redmine_overhead
|
||||
end
|
||||
|
||||
# OPTIMIZE: N+1
|
||||
def hours_spent_total
|
||||
issues.inject(0) {|total, issue| total += issue.spent_hours }
|
||||
|
||||
@@ -133,6 +133,19 @@ class RetainerDeliverable < HourlyDeliverable
|
||||
end
|
||||
end
|
||||
|
||||
def labor_hours_spent_total(date=nil)
|
||||
case scope_date_status(date)
|
||||
when :in
|
||||
time_entries = issues.collect {|issue| issue.time_entries.all(:conditions => {:tyear => date.year, :tmonth => date.month}) }.flatten
|
||||
|
||||
billable_hours_on_time_entries(time_entries)
|
||||
when :out
|
||||
0
|
||||
else
|
||||
super
|
||||
end
|
||||
end
|
||||
|
||||
def fixed_budget_total(date=nil)
|
||||
case scope_date_status(date)
|
||||
when :in
|
||||
|
||||
Reference in New Issue
Block a user