Correctly filter date columns
This commit is contained in:
parent
3ed67b5457
commit
8e07ade8b2
1 changed files with 7 additions and 1 deletions
|
@ -236,9 +236,15 @@ module NewGestionnaire
|
||||||
.where("champs.value LIKE ?", "%#{filter['value']}%")
|
.where("champs.value LIKE ?", "%#{filter['value']}%")
|
||||||
|
|
||||||
when 'user', 'etablissement', 'entreprise'
|
when 'user', 'etablissement', 'entreprise'
|
||||||
dossiers
|
if filter['column'] == 'date_creation'
|
||||||
|
dossiers
|
||||||
|
.includes(filter['table'])
|
||||||
|
.where("#{filter['table'].pluralize}.#{filter['column']} = ?", filter['value'].to_date)
|
||||||
|
else
|
||||||
|
dossiers
|
||||||
.includes(filter['table'])
|
.includes(filter['table'])
|
||||||
.where("#{filter['table'].pluralize}.#{filter['column']} LIKE ?", "%#{filter['value']}%")
|
.where("#{filter['table'].pluralize}.#{filter['column']} LIKE ?", "%#{filter['value']}%")
|
||||||
|
end
|
||||||
|
|
||||||
end.pluck(:id)
|
end.pluck(:id)
|
||||||
end.reduce(:&)
|
end.reduce(:&)
|
||||||
|
|
Loading…
Reference in a new issue