Refactor: pull up method
This commit is contained in:
@@ -76,6 +76,12 @@ class Deliverable < ActiveRecord::Base
|
||||
(total(date) || 0.0) - budgets
|
||||
end
|
||||
|
||||
# The amount of money remaining after expenses have been taken out
|
||||
# Profit left = Total - Labor spent - Overhead spent - Fixed - Markup
|
||||
def profit_left(date=nil)
|
||||
total_spent(date) - labor_budget_spent(date) - overhead_spent(date) - fixed_budget_total_spent(date) - fixed_markup_budget_total_spent(date)
|
||||
end
|
||||
|
||||
def labor_budget_hours(date=nil)
|
||||
labor_budgets.sum(:hours)
|
||||
end
|
||||
|
||||
@@ -20,12 +20,6 @@ class FixedDeliverable < Deliverable
|
||||
total
|
||||
end
|
||||
|
||||
# The amount of money remaining after expenses have been taken out
|
||||
# Profit left = Total - Labor spent - Overhead spent - Fixed - Markup
|
||||
def profit_left(date=nil)
|
||||
total_spent(date) - labor_budget_spent(date) - overhead_spent(date) - fixed_budget_total_spent(date) - fixed_markup_budget_total_spent(date)
|
||||
end
|
||||
|
||||
# Hardcoded value used as a wrapper for the old Budget plugin API.
|
||||
#
|
||||
# The Overhead plugin uses this in it's calcuations.
|
||||
|
||||
@@ -49,10 +49,4 @@ class HourlyDeliverable < Deliverable
|
||||
def clear_total
|
||||
write_attribute(:total, nil)
|
||||
end
|
||||
|
||||
# The amount of money remaining after expenses have been taken out
|
||||
# Profit left = Total - Labor spent - Overhead spent - Fixed - Markup
|
||||
def profit_left(date=nil)
|
||||
total_spent(date) - labor_budget_spent(date) - overhead_spent(date) - fixed_budget_total_spent(date) - fixed_markup_budget_total_spent(date)
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user