blend_spreadsheet_loan_generator 0.1.23 → 0.1.24
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0473a465aaf8c05516fd8ed8eeff3009996f4afe3c9dbc5578df88fb4985a03a
|
4
|
+
data.tar.gz: a73d70c1cbfd2d2241dd2bc875750358bf6893914739b0b5efaf65271e8800f1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 55e0989827c375bc5f13d58c7bef7d7bf0024126f838997b7a5c669e5a4bb378020c4dff1d616b78f6686f3b3050bbba7a5132fd18385cf0aaa668d1e8fd09a6
|
7
|
+
data.tar.gz: 76cbd06e23b5250740ad087e08f4f61f22c6ae828e2ea1dec23559a2d55ae4bfbd5e1f7d72f81f0efa823ca3de7dd7dd86c2ca3c864fb68e7a7d7e4ee41a6bf8
|
@@ -44,7 +44,7 @@ module BlendSpreadsheetLoanGenerator
|
|
44
44
|
values = f.to_a
|
45
45
|
values.map! { |r| set_types([columns, r].transpose.to_h.with_indifferent_access) }
|
46
46
|
|
47
|
-
last_paid_line = values.index { |term| term[:index] == last_paid_term.to_i }
|
47
|
+
last_paid_line = values.index { |term| term[:index] == last_paid_term.to_i } || -1
|
48
48
|
guaranteed_line = values.index { |term| term[:index] == options.fetch(:guaranteed_terms, -1).to_i } || nil
|
49
49
|
total_guaranteed_interests = (
|
50
50
|
if guaranteed_line.present? && guaranteed_line > last_paid_line
|
@@ -65,7 +65,14 @@ module BlendSpreadsheetLoanGenerator
|
|
65
65
|
if total_to_be_paid == amount_paid
|
66
66
|
1
|
67
67
|
else
|
68
|
-
options.fetch(
|
68
|
+
options.fetch(
|
69
|
+
:duration,
|
70
|
+
if last_paid_line == -1
|
71
|
+
values.last[:index]
|
72
|
+
else
|
73
|
+
values.last[:index] - values[last_paid_line][:index]
|
74
|
+
end
|
75
|
+
)
|
69
76
|
end
|
70
77
|
)
|
71
78
|
|
@@ -87,8 +94,15 @@ module BlendSpreadsheetLoanGenerator
|
|
87
94
|
)
|
88
95
|
capital_paid -= guaranteed_interests_paid
|
89
96
|
|
97
|
+
amount = (
|
98
|
+
if last_paid_line == -1
|
99
|
+
values[0][:remaining_capital_end]
|
100
|
+
else
|
101
|
+
values[last_paid_line][:remaining_capital_end]
|
102
|
+
end
|
103
|
+
)
|
90
104
|
@loan = Loan.new(
|
91
|
-
amount:
|
105
|
+
amount: amount,
|
92
106
|
duration: duration,
|
93
107
|
rate: rate,
|
94
108
|
fees_rate: options.fetch(:fees_rate),
|