blend_spreadsheet_loan_generator 0.1.45 → 0.1.99

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: cca84a8a3514638dbbdf412c9c3847f2e5ec299c6a057fe31bf64bed84214d5b
4
- data.tar.gz: bbcea0582d8d49b4deeb03fd18e7485d2c721c74c63625fc0b7b5319d5ff870f
3
+ metadata.gz: 565ddfb9ab9868bd0bc47ca82c3322b7a8a6fa2a5d1a519782bc3f985fa8e668
4
+ data.tar.gz: 1877ad34ba609c03c59f2fabc81d9d91940df5e1194a3455d52d697bbb8d7c83
5
5
  SHA512:
6
- metadata.gz: 1040a0c2b2c5e7a2fbfc4bbb2b277ffa136ce4b57b849a1e96a5f7710aa84125940c779be295ae1cee150427d9c5d4c56b301497d3afcd2cedf079f73177e537
7
- data.tar.gz: 4736c7b12ec0202759f72a953f81da8001c317d6183dfb8846ed0b3695c56a6a55bb58566e7ebdfd1bc85ff1965ee0c9c2bd141bf6dc9e6e6e86e236a13b3aa5
6
+ metadata.gz: 6db635662441108f44574b6b6f9eec16fe94e7394b324ab83213051b84e693391effb880db74e259c46fef54b7b74802adbcee34f95e648d23a20f37a0561f8a
7
+ data.tar.gz: f79d314308aac20dd01f22e5a03f1eb6a47aa1dc87542c4b93ae903d3a5e2c1dad3183acf59c0b6826e0f4dbc4d3559909c3d7222d6373c96fc55793f55871cb
@@ -87,21 +87,21 @@ module BlendSpreadsheetLoanGenerator
87
87
  end
88
88
  end
89
89
 
90
- def custom_early_repayment
90
+ def first_term_skip_columns
91
91
  %w[
92
92
  period_calculated_fees
93
93
  capitalized_fees_end
94
94
  ]
95
95
  end
96
96
 
97
- def apply_formulas(worksheet:, early_repayment: false)
97
+ def apply_formulas(worksheet:, first_term_skip: false)
98
98
  columns.each.with_index do |title, column|
99
99
  worksheet[1, column + 1] = title
100
100
  end
101
101
  loan.duration.times do |line|
102
102
  columns.each.with_index do |title, column|
103
- if early_repayment && title.in?(custom_early_repayment)
104
- worksheet[line + 2, column + 1] = @formula.send("#{title}_formula", line: line + 2, early_repayment: true)
103
+ if first_term_skip && title.in?(custom_early_repayment)
104
+ worksheet[line + 2, column + 1] = @formula.send("#{title}_formula", line: line + 2, first_term_skip: true)
105
105
  else
106
106
  worksheet[line + 2, column + 1] = @formula.send("#{title}_formula", line: line + 2)
107
107
  end
@@ -127,7 +127,7 @@ module BlendSpreadsheetLoanGenerator
127
127
 
128
128
  @formula = Formula.new(loan: loan)
129
129
 
130
- apply_formulas(worksheet: worksheet, early_repayment: true)
130
+ apply_formulas(worksheet: worksheet, first_term_skip: true)
131
131
 
132
132
  worksheet[2, columns.index('remaining_capital_start') + 1] =
133
133
  excel_float(values[last_paid_line + 1][:remaining_capital_start])
@@ -168,11 +168,11 @@ module BlendSpreadsheetLoanGenerator
168
168
  end
169
169
  end
170
170
 
171
- def period_calculated_fees_formula(line:, early_repayment: false)
171
+ def period_calculated_fees_formula(line:, first_term_skip: false)
172
172
  term = line - 1
173
173
  if loan.bullet_term?(term)
174
174
  index = (
175
- if early_repayment
175
+ if first_term_skip
176
176
  index(line - 1)
177
177
  else
178
178
  index(line)
@@ -207,10 +207,10 @@ module BlendSpreadsheetLoanGenerator
207
207
  "=ARRONDI(#{capitalized_fees_end(line - 1)}; 2)"
208
208
  end
209
209
 
210
- def capitalized_fees_end_formula(line:, early_repayment: false)
210
+ def capitalized_fees_end_formula(line:, first_term_skip: false)
211
211
  term = line - 1
212
212
  if term <= loan.deferred_and_capitalized
213
- index = early_repayment ? index(line - 1) : index(line)
213
+ index = first_term_skip ? index(line - 1) : index(line)
214
214
  with_fees = "#{remaining_capital_start(line)} * (1 + #{period_fees_rate(line)} + #{period_rate(line)})^#{index}"
215
215
  without_fees = "#{remaining_capital_start(line)} * (1 + #{period_rate(line)})^#{index}"
216
216
  "=ARRONDI(#{with_fees} - #{without_fees}; 2)"
@@ -72,7 +72,7 @@ module BlendSpreadsheetLoanGenerator
72
72
  spreadsheet = session.create_spreadsheet(loan.name)
73
73
  worksheet = spreadsheet.add_worksheet(loan.type, loan.duration + 2, columns.count + 1, index: 0)
74
74
 
75
- @formula = Formula.new(loan: loan)
75
+ @formula = Formula.new(loan: loan, first_term_skip: true)
76
76
 
77
77
  apply_formulas(worksheet: worksheet)
78
78
  apply_formats(worksheet: worksheet)
@@ -1,7 +1,7 @@
1
1
  require 'dry/cli'
2
2
 
3
3
  module BlendSpreadsheetLoanGenerator
4
- VERSION = '0.1.45'.freeze
4
+ VERSION = '0.1.99'.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.45
4
+ version: 0.1.99
5
5
  platform: ruby
6
6
  authors:
7
7
  - MZiserman