lib/zold/tax.rb in zold-0.6.4 vs lib/zold/tax.rb in zold-0.7
- old
+ new
@@ -67,10 +67,10 @@
next if !score.valid? || score.value < MIN_SCORE
next if t.amount > Tax::MAX_PAYMENT
score
end.reject(&:nil?).uniq(&:hash)
paid = scores.empty? ? Amount::ZERO : scores.map(&:amount).inject(&:+) * -1
- age_hours = (Time.now - txns.sort_by(&:date)[0].date) / 60
+ age_hours = txns.empty? ? 0 : (Time.now - txns.sort_by(&:date)[0].date) / 60
owned = Tax::FEE_TXN_HOUR * txns.count * age_hours
owned - paid
end
end
end