Skip to content

Commit

Permalink
Merge pull request #364 from mikeubell/master
Browse files Browse the repository at this point in the history
Account for loan payback #360
  • Loading branch information
tdooner committed Jan 21, 2015
2 parents 5efee6b + a07ba34 commit 813ed10
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 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
return if row['loan_amt1'].to_i == 0 and row['loan_amt5'].to_i == 0

recipient = DataFetcher.get_filer(row)

Expand Down Expand Up @@ -48,7 +48,7 @@ def self.parse_loan(row)

::Contribution.where(recipient: recipient, transaction_id: row['tran_id'],
contributor: contributor,
amount: row['loan_amt1'], # "amount received this period"
amount: row['loan_amt1'].to_i - row['loan_amt5'].to_i, # "amount received this period less amount paid back"
date: row['loan_date1'],
type: 'loan'
).first_or_create()
Expand Down

0 comments on commit 813ed10

Please sign in to comment.