From b1dc1740c7c1423208d01e897a033e04796736d2 Mon Sep 17 00:00:00 2001 From: Michael Ubell Date: Tue, 20 Jan 2015 19:55:42 -0800 Subject: [PATCH] Account for loan forgivness #360 --- backend/fetchers/loan.rb | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/backend/fetchers/loan.rb b/backend/fetchers/loan.rb index 4b09717..20afb39 100644 --- a/backend/fetchers/loan.rb +++ b/backend/fetchers/loan.rb @@ -11,7 +11,7 @@ def self.parse_loan(row) puts "Skipping " + row.values_at('filer_naml', 'tran_id').join(':') return end - return if row['loan_amt1'].to_i == 0 and row['loan_amt5'].to_i == 0 + return if row['loan_amt1'].to_i == 0 and row['loan_amt5'].to_i == 0 and row['loan_amt6'].to_i == 0 recipient = DataFetcher.get_filer(row) @@ -48,7 +48,9 @@ def self.parse_loan(row) ::Contribution.where(recipient: recipient, transaction_id: row['tran_id'], contributor: contributor, - amount: row['loan_amt1'].to_i - row['loan_amt5'].to_i, # "amount received this period less amount paid back" + # "amount received this period less amount paid backand amount forgiven" + amount: row['loan_amt1'].to_i - + (row['loan_amt5'].to_i + row['loan_amt6'].to_i), date: row['loan_date1'], type: 'loan' ).first_or_create()