[#5442] Add contract totals for labor and overhead hours spent and budgeted
This commit is contained in:
@@ -55,6 +55,19 @@ class Contract < ActiveRecord::Base
|
||||
end
|
||||
memoize :labor_spent
|
||||
|
||||
# OPTIMIZE: N+1
|
||||
def labor_hour_budget
|
||||
summarize_associated_values(deliverables, :labor_budget_hours)
|
||||
end
|
||||
memoize :labor_hour_budget
|
||||
|
||||
# OPTIMIZE: N+1
|
||||
# OPTIMIZE: also hits redmine_overhead which is known to be slow
|
||||
def labor_hour_spent
|
||||
summarize_associated_values(deliverables, :labor_hours_spent_total)
|
||||
end
|
||||
memoize :labor_hour_spent
|
||||
|
||||
# OPTIMIZE: N+1
|
||||
def overhead_budget
|
||||
summarize_associated_values(deliverables, :overhead_budget_total)
|
||||
@@ -68,6 +81,19 @@ class Contract < ActiveRecord::Base
|
||||
end
|
||||
memoize :overhead_spent
|
||||
|
||||
# OPTIMIZE: N+1
|
||||
def overhead_hour_budget
|
||||
summarize_associated_values(deliverables, :overhead_budget_hours)
|
||||
end
|
||||
memoize :overhead_hour_budget
|
||||
|
||||
# OPTIMIZE: N+1
|
||||
# OPTIMIZE: also hits redmine_overhead which is known to be slow
|
||||
def overhead_hour_spent
|
||||
summarize_associated_values(deliverables, :overhead_hours_spent_total)
|
||||
end
|
||||
memoize :overhead_hour_spent
|
||||
|
||||
# OPTIMIZE: N+1
|
||||
def estimated_hour_budget
|
||||
summarize_associated_values(deliverables, :estimated_hour_budget_total)
|
||||
|
||||
@@ -78,7 +78,15 @@
|
||||
<%= show_budget_field(resource, :total_spent, :total_budget, :format => :format_value_field_for_contracts, :html_options => {:class => 'contract-total'}) %>
|
||||
<%= show_budget_field(resource, :billable_rate, 'nil?', :format => :format_hourly_rate, :html_options => {:class => 'contract-billable-rate total'}) %>
|
||||
|
||||
<%= show_budget_field(resource, :estimated_hour_spent, :estimated_hour_budget, :format => :l_hours, :html_options => {:class => 'contract-estimated-hour total'}) %>
|
||||
<tr>
|
||||
<td colspan="3">
|
||||
<div class="hr"></div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<%= show_budget_field(resource, :labor_hour_spent, :labor_hour_budget, :format => :l_hours, :html_options => {:class => 'contract-labor-hour'}) %>
|
||||
<%= show_budget_field(resource, :overhead_hour_spent, :overhead_hour_budget, :format => :l_hours, :html_options => {:class => 'contract-overhead-hour'}) %>
|
||||
<%= show_budget_field(resource, :estimated_hour_spent, :estimated_hour_budget, :format => :l_hours, :html_options => {:class => 'contract-total-hour total'}) %>
|
||||
<tr>
|
||||
<td class="stretch" colspan="3">
|
||||
<!-- Stretch table height -->
|
||||
|
||||
Reference in New Issue
Block a user