blend_spreadsheet_loan_generator 0.1.26 → 0.1.27

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: 46ffd519aaf8bc1d7b8bb2bb84c376e107f04cf2c8af6ee23ad028a563e63d8b
4
- data.tar.gz: da8b157b33839272a2647e201111a4349451a62c569195e95c293071c77800df
3
+ metadata.gz: b500ee01fce00eb5d3a71404f720ae470dd141bf187bef1634f3ad57588ba9f5
4
+ data.tar.gz: 46b53438bd6c349e3c5b52fc6fe333c081c1fd24bf5c098b28c4437abadb0ae4
5
5
  SHA512:
6
- metadata.gz: 3ba10779043886b9870cd78fbbda175362c231a9afd824fa4d0a2107284d16ce493dd76469f542f8508359efd57041306e1727f645c409100e16e50712cf74a9
7
- data.tar.gz: 6c497e6e9d39c7b537a5f07fb14306850b53cfe77b12653cb0ce6dd2b1e4329ce199fb73c007beb50c945e193146cddb7ad20cd1526f1beb15a5b3ee828f86b3
6
+ metadata.gz: c2ff7ffde2072fda5f29fb4fcaf61f6e3bccb663855c3527bba5d6f416d2949b2bc6a45bf92be0cc548f0976406dc115e54d225b01716b0072f8092a936b125e
7
+ data.tar.gz: 673dd3c59ce84d779cced52348043ce32e216faa5dc54bc332a8653206618f63ef5348b3a36b342e63ecfb26b3e795d99946c569c609314771300f0e47e00a66
@@ -33,6 +33,7 @@ module BlendSpreadsheetLoanGenerator
33
33
  period_reimbursed_capitalized_fees
34
34
  period_fees_rate
35
35
  period_reimbursed_guaranteed_interests
36
+ period_reimbursed_guaranteed_fees
36
37
  ]
37
38
  end
38
39
 
@@ -54,6 +55,7 @@ module BlendSpreadsheetLoanGenerator
54
55
  capitalized_fees_end
55
56
  period_reimbursed_capitalized_fees
56
57
  period_reimbursed_guaranteed_interests
58
+ period_reimbursed_guaranteed_fees
57
59
  ]
58
60
  end
59
61
 
@@ -46,13 +46,14 @@ module BlendSpreadsheetLoanGenerator
46
46
 
47
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
- total_guaranteed_interests = (
50
- if guaranteed_line.present? && guaranteed_line >= (last_paid_line + 2)
51
- values[(last_paid_line + 2)..guaranteed_line].sum { |value| value[:period_calculated_interests] }
52
- else
53
- 0
54
- end
55
- )
49
+
50
+ if guaranteed_line.present? && guaranteed_line >= (last_paid_line + 2)
51
+ total_guaranteed_interests = values[(last_paid_line + 2)..guaranteed_line].sum { |value| value[:period_calculated_interests] }
52
+ total_guaranteed_fees = values[(last_paid_line + 2)..guaranteed_line].sum { |value| value[:period_calculated_fees] }
53
+ else
54
+ total_guaranteed_interests = 0
55
+ total_guaranteed_fees = 0
56
+ end
56
57
 
57
58
  total_to_be_paid = (
58
59
  values[last_paid_line + 1][:remaining_capital_start] +
@@ -86,9 +87,8 @@ module BlendSpreadsheetLoanGenerator
86
87
  )
87
88
 
88
89
  ratio = options.fetch(:ratio, (capital_paid.to_f / values[last_paid_line + 1][:remaining_capital_start])).to_f
89
- guaranteed_interests_paid = (
90
- ratio * total_guaranteed_interests
91
- )
90
+ guaranteed_interests_paid = ratio * total_guaranteed_interests
91
+ guaranteed_fees_paid = ratio * total_guaranteed_fees
92
92
 
93
93
  amount = (
94
94
  if last_paid_line == -1
@@ -156,6 +156,9 @@ module BlendSpreadsheetLoanGenerator
156
156
  worksheet[2, columns.index('period_reimbursed_guaranteed_interests') + 1] =
157
157
  excel_float(guaranteed_interests_paid)
158
158
 
159
+ worksheet[2, columns.index('period_reimbursed_guaranteed_fees') + 1] =
160
+ excel_float(guaranteed_fees_paid)
161
+
159
162
  apply_formats(worksheet: worksheet)
160
163
 
161
164
  worksheet.save
@@ -196,6 +199,7 @@ module BlendSpreadsheetLoanGenerator
196
199
  h[:period_reimbursed_capitalized_fees] = h[:period_reimbursed_capitalized_fees].to_f
197
200
  h[:period_fees_rate] = h[:period_fees_rate].to_f
198
201
  h[:period_reimbursed_guaranteed_interests] = h[:period_reimbursed_guaranteed_interests].to_f
202
+ h[:period_reimbursed_guaranteed_fees] = h[:period_reimbursed_guaranteed_fees].to_f
199
203
 
200
204
  h
201
205
  end
@@ -213,5 +213,9 @@ module BlendSpreadsheetLoanGenerator
213
213
  def period_reimbursed_guaranteed_interests_formula(line:)
214
214
  excel_float(0.0)
215
215
  end
216
+
217
+ def period_reimbursed_guaranteed_fees_formula(line:)
218
+ excel_float(0.0)
219
+ end
216
220
  end
217
221
  end
@@ -24,12 +24,6 @@ module BlendSpreadsheetLoanGenerator
24
24
 
25
25
  def call(amount:, duration:, rate:, **options)
26
26
  begin
27
- # session = GoogleDrive::Session.from_service_account_key(
28
- # File.join(
29
- # ENV['SPREADSHEET_LOAN_GENERATOR_DIR'],
30
- # 'loan-spreadsheet-generator-6c27a42bdda7.json'
31
- # )
32
- # )
33
27
  session = GoogleDrive::Session.from_config(
34
28
  File.join(ENV['SPREADSHEET_LOAN_GENERATOR_DIR'], 'config.json')
35
29
  )
@@ -71,9 +65,6 @@ module BlendSpreadsheetLoanGenerator
71
65
  generate_csv(worksheet: worksheet, target_path: options.fetch(:target_path))
72
66
 
73
67
  puts worksheet.human_url
74
- rescue => e
75
- require 'pry'
76
- binding.pry
77
68
  end
78
69
  end
79
70
  end
@@ -1,7 +1,7 @@
1
1
  require 'dry/cli'
2
2
 
3
3
  module BlendSpreadsheetLoanGenerator
4
- VERSION = '0.1.26'.freeze
4
+ VERSION = '0.1.27'.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.26
4
+ version: 0.1.27
5
5
  platform: ruby
6
6
  authors:
7
7
  - MZiserman