[#4477] Added the amounts spent for FixedBudgets
This commit is contained in:
@@ -92,11 +92,20 @@ class Deliverable < ActiveRecord::Base
|
||||
fixed_budgets.sum(:budget)
|
||||
end
|
||||
|
||||
def fixed_budget_total_spent(date=nil)
|
||||
fixed_budgets.paid.sum(:budget)
|
||||
end
|
||||
|
||||
# OPTIMIZE: N+1
|
||||
def fixed_markup_budget_total(date=nil)
|
||||
fixed_budgets.inject(0) {|total, fixed_budget| total += fixed_budget.markup_value }
|
||||
end
|
||||
|
||||
# OPTIMIZE: N+1
|
||||
def fixed_markup_budget_total_spent(date=nil)
|
||||
fixed_budgets.paid.inject(0) {|total, fixed_budget| total += fixed_budget.markup_value }
|
||||
end
|
||||
|
||||
def filter_by_date(date=nil, &block)
|
||||
block.call
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user