diff --git a/app/models/contract.rb b/app/models/contract.rb
index 6870b3a..af0bc5b 100644
--- a/app/models/contract.rb
+++ b/app/models/contract.rb
@@ -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)
diff --git a/app/views/contracts/show.html.erb b/app/views/contracts/show.html.erb
index 9943bae..ea9830a 100644
--- a/app/views/contracts/show.html.erb
+++ b/app/views/contracts/show.html.erb
@@ -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'}) %>
+
+ |
+
+ |
+
+
+ <%= 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'}) %>
|
diff --git a/config/locales/en.yml b/config/locales/en.yml
index 88cde12..661837d 100644
--- a/config/locales/en.yml
+++ b/config/locales/en.yml
@@ -34,8 +34,11 @@ en:
field_client_point_of_contact: "Point of Contact"
field_discount_budget: "Discount"
field_discount_spent: "Discount"
- field_estimated_hour_budget: "Est. Hours"
- field_estimated_hour_spent: "Est. Hours"
+ field_estimated_hour_budget: "Total Hours"
+ field_estimated_hour_spent: "Total Hours"
+ field_labor_hour_spent: "Labor Hours"
+ field_overhead_hour_spent: "Overhead Hours"
+ field_total_hours: "Total Hours"
field_fixed_budget: "Fixed"
field_fixed_spent: "Fixed"
field_labor_budget: "Labor"
@@ -78,3 +81,4 @@ en:
text_error_message_orphaned_time: "There is {{amount}} worth of time clocked to issues that are not assigned to any deliverables."
text_error_message_update_orphaned_time: "Please update the orphaned issues."
field_estimated: Estimated
+
diff --git a/test/integration/contracts_show_test.rb b/test/integration/contracts_show_test.rb
index 85995e1..46884e8 100644
--- a/test/integration/contracts_show_test.rb
+++ b/test/integration/contracts_show_test.rb
@@ -82,8 +82,12 @@ class ContractsShowTest < ActionController::IntegrationTest
assert_select '.contract-billable-rate'
- assert_select '.contract-estimated-hour .spent'
- assert_select '.contract-estimated-hour .budget'
+ assert_select '.contract-labor-hour .spent'
+ assert_select '.contract-labor-hour .budget'
+ assert_select '.contract-overhead-hour .spent'
+ assert_select '.contract-overhead-hour .budget'
+ assert_select '.contract-total-hour .spent'
+ assert_select '.contract-total-hour .budget'
end
end
end
@@ -481,10 +485,12 @@ class ContractsShowTest < ActionController::IntegrationTest
visit_contract_page(@contract)
# Overages on:
- assert_select '.overage', :count => 12
+ assert_select '.overage', :count => 14
assert_select '.contract-labor .overage', :count => 2
assert_select '.contract-overhead .overage', :count => 2
- assert_select '.contract-estimated-hour.total .overage'
+ assert_select '.contract-labor-hour .overage'
+ assert_select '.contract-overhead-hour .overage'
+ assert_select '.contract-total-hour .overage'
assert_select '#deliverables .spent-amount.labor.overage'
assert_select '#deliverables .spent-amount.overhead.overage'
|