Catch nil cost_per_hour and total_hours on the HourlyDeliverable.profit. #1387
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user