Skip to content

Commit

Permalink
Account for loan forgivness openoakland#360
Browse files Browse the repository at this point in the history
  • Loading branch information
mikeubell committed Jan 21, 2015
1 parent 813ed10 commit b1dc174
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions backend/fetchers/loan.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down Expand Up @@ -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()
Expand Down

0 comments on commit b1dc174

Please sign in to comment.