blend_spreadsheet_loan_generator 0.1.99 → 0.1.100

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: 565ddfb9ab9868bd0bc47ca82c3322b7a8a6fa2a5d1a519782bc3f985fa8e668
4
- data.tar.gz: 1877ad34ba609c03c59f2fabc81d9d91940df5e1194a3455d52d697bbb8d7c83
3
+ metadata.gz: '094d6041671fe31e1d4065b08a380527d0c823a14921d1e240fe27668de71062'
4
+ data.tar.gz: 445f25c29e92de5b36dcd6a687f4a94fbfe0a2d30705dd623fb1f03315f3991a
5
5
  SHA512:
6
- metadata.gz: 6db635662441108f44574b6b6f9eec16fe94e7394b324ab83213051b84e693391effb880db74e259c46fef54b7b74802adbcee34f95e648d23a20f37a0561f8a
7
- data.tar.gz: f79d314308aac20dd01f22e5a03f1eb6a47aa1dc87542c4b93ae903d3a5e2c1dad3183acf59c0b6826e0f4dbc4d3559909c3d7222d6373c96fc55793f55871cb
6
+ metadata.gz: 12f8be613825bbf69472ea9332e72d77ef85d4cf53072f1734ac3be632b0ddcfa2d7a3b9f53e7cb6dc2fb719de90a364e7c76dee05995215753233f7d10f5d9c
7
+ data.tar.gz: 9c0735c99dcf516f92b9458dedd69e42e2c303df500dfaf809d0164cc35054f26dd34e9c48d2f6ba558aeb12e1a702253e2f3e6aacdc74456f23afac837ef577
@@ -171,21 +171,18 @@ module BlendSpreadsheetLoanGenerator
171
171
  def period_calculated_fees_formula(line:, first_term_skip: false)
172
172
  term = line - 1
173
173
  if loan.bullet_term?(term)
174
- index = (
175
- if first_term_skip
176
- index(line - 1)
177
- else
178
- index(line)
179
- end
180
- )
174
+ index = first_term_skip ? index(line - 1) : index(line)
175
+
181
176
  with_fees = "#{remaining_capital_start(line)} * (1 + #{period_fees_rate(line)} + #{period_rate(line)})^#{index}"
182
177
  without_fees = "#{remaining_capital_start(line)} * (1 + #{period_rate(line)})^#{index}"
183
178
  current = "#{with_fees} - #{without_fees}"
184
179
 
185
180
  "=#{current} - #{capitalized_fees_start(line)}"
186
181
  elsif loan.deferred_and_capitalized > 0 && term > loan.deferred_and_capitalized
187
- with_fees = "#{remaining_capital_start(line)} * (1 + #{period_rate(line)} + #{period_fees_rate(line)})^#{loan.deferred_and_capitalized} * (#{period_rate(line)} + #{period_fees_rate(line)})"
188
- without_fees = "#{remaining_capital_start(line)} * (1 + #{period_rate(line)})^#{loan.deferred_and_capitalized} * #{period_rate(line)}"
182
+ index = first_term_skip ? loan.deferred_and_capitalized : loan.deferred_and_capitalized - 1
183
+
184
+ with_fees = "#{remaining_capital_start(line)} * (1 + #{period_rate(line)} + #{period_fees_rate(line)})^#{index} * (#{period_rate(line)} + #{period_fees_rate(line)})"
185
+ without_fees = "#{remaining_capital_start(line)} * (1 + #{period_rate(line)})^#{index} * #{period_rate(line)}"
189
186
 
190
187
  "=#{with_fees} - #{without_fees}"
191
188
  else
@@ -1,7 +1,7 @@
1
1
  require 'dry/cli'
2
2
 
3
3
  module BlendSpreadsheetLoanGenerator
4
- VERSION = '0.1.99'.freeze
4
+ VERSION = '0.1.100'.freeze
5
5
 
6
6
  class Version < Dry::CLI::Command
7
7
  desc 'Print version'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: blend_spreadsheet_loan_generator
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.99
4
+ version: 0.1.100
5
5
  platform: ruby
6
6
  authors:
7
7
  - MZiserman