[#4183] HourlyDeliverable#total (budget) should only include labor budget.
This commit is contained in:
@@ -19,8 +19,7 @@ class HourlyDeliverable < Deliverable
|
||||
return 0 if contract.billable_rate.blank?
|
||||
return 0 if labor_budgets.count == 0 && overhead_budgets.count == 0
|
||||
|
||||
hours = labor_budgets.sum(:hours) + overhead_budgets.sum(:hours)
|
||||
return contract.billable_rate * hours
|
||||
return contract.billable_rate * labor_budgets.sum(:hours)
|
||||
end
|
||||
|
||||
# Block setting the total on HourlyDeliverables
|
||||
|
||||
@@ -20,13 +20,13 @@ class HourlyDeliverableTest < ActiveSupport::TestCase
|
||||
assert_equal 0, d.total
|
||||
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)
|
||||
d = HourlyDeliverable.generate!(:contract => contract)
|
||||
d.labor_budgets << LaborBudget.generate!(:hours => 10)
|
||||
d.overhead_budgets << OverheadBudget.generate!(:hours => 20)
|
||||
|
||||
assert_equal 100.0 * 30, d.total
|
||||
assert_equal 100.0 * 10, d.total
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user