blend_spreadsheet_loan_generator 0.1.112 → 0.1.113

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: 526e63e619b84d693c93294a98fd9354c9b35f4eb3c47b6d0e4ff49b533f30cd
4
- data.tar.gz: 81192d4e8cd832a94f83948beb8b513463456a92cedf3f5d8501cc4f11179345
3
+ metadata.gz: 3a686aabdf2ad77dc1401d3a58a9048c819f26baa430f7230b161189b2aab7f1
4
+ data.tar.gz: 5507bea96b5ff6c0dcb6e3d377edaf3a2c74c96fe29fcd769dc87530d00635f0
5
5
  SHA512:
6
- metadata.gz: f159a1b328f8b3def5613359277911aa27183eeed5d27140a54ce4fbf7d0dc79e59ec0bee630ff71c9dc20939de21c3b843f7c5e375276907a9187d5f2820ada
7
- data.tar.gz: 15a5ef2042d922da1421c2d367961aa4f0f8667b2ff3a2956def5ad95ad1e6ad3a63ba2190e075e00629e1ec33c24373222fea743a4414e1865177d738628119
6
+ metadata.gz: 6f1a3ab207cebd8f8f678f878b4ddcee383ec9262c7135f4d951853a1a2736da80779e759a69e8f3955058910b8edd86ffbc5620232c51e5702f5eee28ec3d2a
7
+ data.tar.gz: 61f3e0ed44d252ba8c1027fea4a29334b35338cebbbd1a2bfb316aca895ad9fa875ea546477d0d04c0f4bda5439362e5195d6a8978d6ea7e62c9594828831493
@@ -79,19 +79,23 @@ module BlendSpreadsheetLoanGenerator
79
79
 
80
80
  due_on = values[last_paid_line + 1][:due_on] + 1.month
81
81
 
82
- capital_paid = amount_paid.to_f - (
82
+ capital_paid_for_ratio = amount_paid.to_f - (
83
83
  values[last_paid_line + 1][:period_interests] +
84
84
  values[last_paid_line + 1][:period_reimbursed_capitalized_interests] +
85
85
  values[last_paid_line + 1][:period_fees] +
86
86
  values[last_paid_line + 1][:period_reimbursed_capitalized_fees] +
87
87
  values[last_paid_line + 1][:capitalized_fees_end]
88
88
  )
89
+ capital_paid = [
90
+ 0,
91
+ capital_paid_for_ratio - values[last_paid_line + 1][:capitalized_interests_end]
92
+ ].max
89
93
  remaining_capital_for_ratio = (
90
94
  values[last_paid_line + 1][:remaining_capital_start] +
91
95
  values[last_paid_line + 1][:capitalized_interests_end]
92
96
  )
93
97
 
94
- ratio = options.fetch(:ratio, capital_paid.to_f / remaining_capital_for_ratio).to_f
98
+ ratio = options.fetch(:ratio, capital_paid_for_ratio.to_f / remaining_capital_for_ratio).to_f
95
99
  guaranteed_interests_paid = ratio * total_guaranteed_interests
96
100
  guaranteed_fees_paid = ratio * total_guaranteed_fees
97
101
 
@@ -1,7 +1,7 @@
1
1
  require 'dry/cli'
2
2
 
3
3
  module BlendSpreadsheetLoanGenerator
4
- VERSION = '0.1.112'.freeze
4
+ VERSION = '0.1.113'.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.112
4
+ version: 0.1.113
5
5
  platform: ruby
6
6
  authors:
7
7
  - MZiserman