|
|
@@ -118,12 +118,13 @@
|
|
|
summing periods into total-periods
|
|
|
summing (* periods (saver/payment-amount income)) into total-income
|
|
|
finally (return (values total-periods total-income)))
|
|
|
- (let ((payment-income-fracture (/ (saver/payment-amount payment) total-income -1)))
|
|
|
+ (let ((payment-income-fracture (unless (zerop total-income)
|
|
|
+ (/ (saver/payment-amount payment) total-income -1))))
|
|
|
(loop for income in incomes
|
|
|
for periods = (saver/payment-count-events income prev-payment moment)
|
|
|
summing periods into saved-periods
|
|
|
- summing (floor (* periods (saver/payment-amount income)
|
|
|
- payment-income-fracture)) into saved-amount
|
|
|
+ summing (round (* periods (saver/payment-amount income)
|
|
|
+ (or payment-income-fracture 0))) into saved-amount
|
|
|
finally (return
|
|
|
(list :next-payment next-payment
|
|
|
:prev-payment prev-payment
|
|
|
@@ -149,7 +150,8 @@
|
|
|
summing (getf cur-info :saved-amount) into cur-saved
|
|
|
summing (getf cur-info :left-amount) into cur-left
|
|
|
summing (if (> (getf nxt-info :left-periods) 1)
|
|
|
- (floor (* (saver/payment-amount income) (getf cur-info :payment-income-fracture)))
|
|
|
+ (round (* (saver/payment-amount income)
|
|
|
+ (or (getf cur-info :payment-income-fracture) 0)))
|
|
|
(getf nxt-info :left-amount)) into next-save
|
|
|
finally (return
|
|
|
(list :cur-saved cur-saved
|