commit
73ebf6afa6
2 changed files with 11 additions and 3 deletions
|
@ -111,7 +111,7 @@ class ProcedurePresentation < ApplicationRecord
|
||||||
column = sanitized_column(filter)
|
column = sanitized_column(filter)
|
||||||
case table
|
case table
|
||||||
when 'self'
|
when 'self'
|
||||||
date = Time.zone.parse(filter['value'])
|
date = Time.zone.parse(filter['value']) rescue nil
|
||||||
if date.present?
|
if date.present?
|
||||||
dossiers.where("#{column} BETWEEN ? AND ?", date, date + 1.day)
|
dossiers.where("#{column} BETWEEN ? AND ?", date, date + 1.day)
|
||||||
else
|
else
|
||||||
|
|
|
@ -406,9 +406,17 @@ describe ProcedurePresentation do
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'for a malformed date' do
|
context 'for a malformed date' do
|
||||||
|
context 'when its a string' do
|
||||||
let(:filter) { [{ 'table' => 'self', 'column' => 'updated_at', 'value' => 'malformed date' }] }
|
let(:filter) { [{ 'table' => 'self', 'column' => 'updated_at', 'value' => 'malformed date' }] }
|
||||||
it { is_expected.to match([]) }
|
it { is_expected.to match([]) }
|
||||||
end
|
end
|
||||||
|
|
||||||
|
context 'when its a number' do
|
||||||
|
let(:filter) { [{ 'table' => 'self', 'column' => 'updated_at', 'value' => '177500' }] }
|
||||||
|
|
||||||
|
it { is_expected.to match([]) }
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'for type_de_champ table' do
|
context 'for type_de_champ table' do
|
||||||
|
|
Loading…
Reference in a new issue