Skip to content

Commit

Permalink
Better amount/balance comparison in Letterable#letterable_items
Browse files Browse the repository at this point in the history
  • Loading branch information
Aquaj committed Jan 6, 2017
1 parent 91f7b06 commit 9592241
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions app/models/concerns/letterable.rb
Expand Up @@ -36,8 +36,8 @@ def letterable_items(bank_statement_items)
return false unless mode.cash_id == bank_statement.cash_id

items = BankStatementItem.where(id: bank_statement_items)
bank_items_balance = items.sum(:debit) - items.sum(:credit)
return false unless -relative_amount == bank_items_balance
bank_items_balance = items.sum(:credit) - items.sum(:debit)
return false unless relative_amount == bank_items_balance
items
end
end

0 comments on commit 9592241

Please sign in to comment.