blend_spreadsheet_loan_generator 0.1.103 → 0.1.107

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a53645750943fd847c6d787a9bbc73f23982daa5793ecb37f92100167d905b9e
4
- data.tar.gz: 895e30e96a23336012ca31e8f772f354efb8feb0670d612fa2ca068b5979444b
3
+ metadata.gz: e066d31e3aac210b466d4e3e6993d408dc26dcba046a5a1ecfe181b2dabb0989
4
+ data.tar.gz: b52baa3e2c499f79960579c5cfd0d33e28d288c3ca0b1263e3b02c7ba271657f
5
5
  SHA512:
6
- metadata.gz: bf34f63e6d2bcfe7c983f4a191fa12de929dc56cf859f54f3676a0a981b3a7d735e9499b89d3599094ff7294f0a7fd07ddc523ec32343b9c4dd08fef4b72f644
7
- data.tar.gz: 741777ca11694b3330609ce0aefd11df91234af988091d23605b75a895387466f3a5bb48bae43acdd4da2648e30193a142962871570402a59e63f635221a066c
6
+ metadata.gz: 2637dd47c2545133a83c24d299cd4c72dd81ca02056fd210504a4100c85cc2eaa0534303c0a0415c9a83d76983893fdc9c567945ae29619a8d32ebb3f38a64d1
7
+ data.tar.gz: a3b538214455f066f8bcddeae2920df8255bf43d9f5294efd25e715978b83a0836b6cb82f65786b2f52712e48a91f82ae3663176de15cd41967244da64d7545d
@@ -80,19 +80,16 @@ module BlendSpreadsheetLoanGenerator
80
80
  due_on = values[last_paid_line + 1][:due_on] + 1.month
81
81
 
82
82
  capital_paid = amount_paid.to_f - (
83
- values[last_paid_line + 1][:capitalized_interests_start] +
84
- values[last_paid_line + 1][:capitalized_fees_start] +
85
- values[last_paid_line + 1][:period_calculated_interests] +
86
- values[last_paid_line + 1][:period_calculated_fees]
83
+ values[last_paid_line + 1][:capitalized_interests_end] +
84
+ values[last_paid_line + 1][:capitalized_fees_end]
87
85
  )
88
86
  capital_paid_for_ratio = amount_paid.to_f - (
89
- values[last_paid_line + 1][:capitalized_fees_start] +
90
- values[last_paid_line + 1][:period_calculated_fees]
87
+ values[last_paid_line + 1][:period_interests] +
88
+ values[last_paid_line + 1][:period_fees]
91
89
  )
92
90
  remaining_capital_for_ratio = (
93
- values[last_paid_line + 1][:remaining_capital_start] +
94
- values[last_paid_line + 1][:capitalized_interests_start] +
95
- values[last_paid_line + 1][:period_calculated_interests]
91
+ values[last_paid_line + 1][:remaining_capital_end] +
92
+ values[last_paid_line + 1][:capitalized_interests_end]
96
93
  )
97
94
 
98
95
  ratio = options.fetch(:ratio, capital_paid_for_ratio.to_f / remaining_capital_for_ratio).to_f
@@ -170,7 +170,7 @@ module BlendSpreadsheetLoanGenerator
170
170
 
171
171
  def period_calculated_fees_formula(line:, first_term_skip: false)
172
172
  term = line - 1
173
- return excel_float(0.0) if first_term_skip
173
+ return excel_float(0.0) if first_term_skip && term == 1
174
174
  if loan.bullet_term?(term)
175
175
  index = first_term_skip ? index(line - 1) : index(line)
176
176
 
@@ -180,7 +180,7 @@ module BlendSpreadsheetLoanGenerator
180
180
 
181
181
  "=#{current} - #{capitalized_fees_start(line)}"
182
182
  elsif loan.deferred_and_capitalized > 0 && term > loan.deferred_and_capitalized
183
- index = first_term_skip ? loan.deferred_and_capitalized : loan.deferred_and_capitalized - 1
183
+ index = first_term_skip ? loan.deferred_and_capitalized - 1 : loan.deferred_and_capitalized
184
184
 
185
185
  with_fees = "#{remaining_capital_start(line)} * (1 + #{period_rate(line)} + #{period_fees_rate(line)})^#{index} * (#{period_rate(line)} + #{period_fees_rate(line)})"
186
186
  without_fees = "#{remaining_capital_start(line)} * (1 + #{period_rate(line)})^#{index} * #{period_rate(line)}"
@@ -207,7 +207,7 @@ module BlendSpreadsheetLoanGenerator
207
207
 
208
208
  def capitalized_fees_end_formula(line:, first_term_skip: false)
209
209
  term = line - 1
210
- return excel_float(0.0) if first_term_skip
210
+ return excel_float(0.0) if first_term_skip && term == 1
211
211
  if term <= loan.deferred_and_capitalized
212
212
  index = first_term_skip ? index(line - 1) : index(line)
213
213
  with_fees = "#{remaining_capital_start(line)} * (1 + #{period_fees_rate(line)} + #{period_rate(line)})^#{index}"
@@ -74,7 +74,7 @@ module BlendSpreadsheetLoanGenerator
74
74
 
75
75
  @formula = Formula.new(loan: loan)
76
76
 
77
- apply_formulas(worksheet: worksheet, first_term_skip: true)
77
+ apply_formulas(worksheet: worksheet)
78
78
  apply_formats(worksheet: worksheet)
79
79
 
80
80
  worksheet.save
@@ -1,7 +1,7 @@
1
1
  require 'dry/cli'
2
2
 
3
3
  module BlendSpreadsheetLoanGenerator
4
- VERSION = '0.1.103'.freeze
4
+ VERSION = '0.1.107'.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.103
4
+ version: 0.1.107
5
5
  platform: ruby
6
6
  authors:
7
7
  - MZiserman