[#4477] Hook up FixedBudgets to Contract#fixed_budget and #fixed_markup_budget
This commit is contained in:
1 parent
edc8db7fe2
commit
294c88f11d
5 files changed
+58
-5
No files matched your search
@@ -88,6 +88,15 @@ class Deliverable < ActiveRecord::Base
|
||||
issues.inject(0) {|total, issue| total += issue.spent_hours }
|
||||
end
|
||||
|
||||
def fixed_budget_total(date=nil)
|
||||
fixed_budgets.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
|
||||
|
||||
def filter_by_date(date=nil, &block)
|
||||
block.call
|
||||
end
|
||||
|
||||
Reference in new issue
Block a user