[#4420] Changed the approach for Retainer calculations by using an optional parameter.

This commit is contained in:
Eric Davis committed 2010-09-08 17:49:51 -07:00
1 parent c8b86db4c4
commit 82dec74eb7
6 files changed
+127 -70

No files matched your search

+12 -8
View File
@@ -54,20 +54,20 @@ class Deliverable < ActiveRecord::Base
end
end
def labor_budget_total
def labor_budget_total(date=nil)
labor_budgets.sum(:budget)
end
def labor_budget_total_for_date(date=nil) #Used on subclasses
labor_budget_total
end
def overhead_budget_total
def overhead_budget_total(date=nil)
overhead_budgets.sum(:budget)
end
def overhead_budget_total_for_date(date=nil) #Used on subclasses
overhead_budget_total
def profit_budget(date=nil)
nil
end
def labor_budget_hours(date=nil)
labor_budgets.sum(:hours)
end
# Total number of hours estimated in the Deliverable's budgets
@@ -81,6 +81,10 @@ class Deliverable < ActiveRecord::Base
issues.inject(0) {|total, issue| total += issue.spent_hours }
end
def filter_by_date(date=nil, &block)
block.call
end
def retainer?
type == "RetainerDeliverable"
end