add filters for most columns, realise what mistake I made

This commit is contained in:
Felix Van der Jeugt 2015-09-10 00:05:26 +02:00
parent 5e4a5b727c
commit 8287b26d3f

View file

@ -4,7 +4,12 @@ module DataTable
def apply_filter(user, params) def apply_filter(user, params)
params = sanitize_params(params) params = sanitize_params(params)
selection_to_json user, params, user.transactions selection_to_json user, params[:draw], user.transactions
.where(created_at: params[:columns][:time][:lower]..params[:columns][:time][:upper])
.where("('debtor' = :id AND 'creditor' LIKE :peer) OR ('creditor' = :id AND 'debtor' LIKE :peer)", id: user.id, peer: "%#{params[:columns][:peer][:value]}%")
.where("'issuer' LIKE :re", re: "%#{params[:columns][:issuer][:value]}%")
.where("'message' LIKE :re", re: "%#{params[:columns][:message][:value]}%")
# TODO: what about nil?
end end
private private