diff --git a/app/models/hourly_deliverable.rb b/app/models/hourly_deliverable.rb index f32d372..91afde2 100644 --- a/app/models/hourly_deliverable.rb +++ b/app/models/hourly_deliverable.rb @@ -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 diff --git a/test/unit/hourly_deliverable_test.rb b/test/unit/hourly_deliverable_test.rb index 63856d1..611d762 100644 --- a/test/unit/hourly_deliverable_test.rb +++ b/test/unit/hourly_deliverable_test.rb @@ -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