[#2179] Simplify dossier_by_exact_id_for_gestionnaire

This commit is contained in:
Frederic Merizen 2018-07-31 14:54:55 +02:00
parent 20b886fb85
commit 8744e9b83d

View file

@ -16,11 +16,9 @@ class DossierSearchService
def self.dossier_by_exact_id_for_gestionnaire(search_terms, gestionnaire)
id = search_terms.to_i
if id != 0 && id_compatible?(id) # Sometimes gestionnaire is searching dossiers with a big number (ex: SIRET), ActiveRecord can't deal with them and throws ActiveModel::RangeError. id_compatible? prevents this.
dossiers = dossiers_by_id(id, gestionnaire)
end
if dossiers.nil?
dossiers = Dossier.none
dossiers_by_id(id, gestionnaire)
else
Dossier.none
end
end