fix general retartedness on my side

This commit is contained in:
Ilion Beyst 2015-09-11 12:07:39 +02:00
parent bf9a845780
commit 4fad3416c0
2 changed files with 5 additions and 6 deletions

View file

@ -31,10 +31,9 @@ class DataTable
end end
def query def query
return @query if @query # Do not build query twice q = @transactions.query
@query = @transactions.query q.where(predicate) if predicate
@query.where(predicate) if predicate q
@query
end end
def predicate def predicate

View file

@ -60,10 +60,10 @@ class TransactionsQuery
def incoming def incoming
@user.incoming_transactions.arel @user.incoming_transactions.arel
@transactions @transactions
.where(@transactions[:debtor_id].eq(@user.id)) .where(@transactions[:creditor_id].eq(@user.id))
.project( .project(
@transactions[:amount], @transactions[:amount],
@transactions[:creditor_id].as('peer_id'), @transactions[:debtor_id].as('peer_id'),
@transactions[:created_at].as('time'), @transactions[:created_at].as('time'),
@transactions[:issuer_id], @transactions[:issuer_id],
@transactions[:issuer_type], @transactions[:issuer_type],