[#4183] HourlyDeliverable#total (budget) should only include labor budget.

This commit is contained in:
Eric Davis
2010-07-13 17:38:49 -07:00
parent d8196842ff
commit 80cde2d222
2 changed files with 3 additions and 4 deletions
+1 -2
View File
@@ -19,8 +19,7 @@ class HourlyDeliverable < Deliverable
return 0 if contract.billable_rate.blank? return 0 if contract.billable_rate.blank?
return 0 if labor_budgets.count == 0 && overhead_budgets.count == 0 return 0 if labor_budgets.count == 0 && overhead_budgets.count == 0
hours = labor_budgets.sum(:hours) + overhead_budgets.sum(:hours) return contract.billable_rate * labor_budgets.sum(:hours)
return contract.billable_rate * hours
end end
# Block setting the total on HourlyDeliverables # Block setting the total on HourlyDeliverables
+2 -2
View File
@@ -20,13 +20,13 @@ class HourlyDeliverableTest < ActiveSupport::TestCase
assert_equal 0, d.total assert_equal 0, d.total
end end
should "multiply the total number of budgeted hours by the contract billable rate" do should "multiply the total number of labor budget hours by the contract billable rate" do
contract = Contract.generate!(:billable_rate => 100.0) contract = Contract.generate!(:billable_rate => 100.0)
d = HourlyDeliverable.generate!(:contract => contract) d = HourlyDeliverable.generate!(:contract => contract)
d.labor_budgets << LaborBudget.generate!(:hours => 10) d.labor_budgets << LaborBudget.generate!(:hours => 10)
d.overhead_budgets << OverheadBudget.generate!(:hours => 20) d.overhead_budgets << OverheadBudget.generate!(:hours => 20)
assert_equal 100.0 * 30, d.total assert_equal 100.0 * 10, d.total
end end
end end