Catch nil cost_per_hour and total_hours on the HourlyDeliverable.profit. #1387

This commit is contained in:
Eric Davis
2008-06-26 16:39:20 -07:00
parent 47339e024b
commit 5e36cf455e
+1
View File
@@ -35,6 +35,7 @@ class HourlyDeliverable < Deliverable
if read_attribute(:profit_percent).nil?
return super
else
return 0.0 if read_attribute(:cost_per_hour).nil? || read_attribute(:total_hours).nil?
labor = (read_attribute(:cost_per_hour) * read_attribute(:total_hours))
return (read_attribute(:profit_percent).to_f / 100.0) * (labor + self.overhead)