add filters for most columns, realise what mistake I made
This commit is contained in:
parent
5e4a5b727c
commit
8287b26d3f
1 changed files with 6 additions and 1 deletions
|
@ -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
|
||||||
|
|
Loading…
Reference in a new issue