From 8744e9b83ddf05d3bf634a5336f0c7d815e1d990 Mon Sep 17 00:00:00 2001 From: Frederic Merizen Date: Tue, 31 Jul 2018 14:54:55 +0200 Subject: [PATCH] [#2179] Simplify dossier_by_exact_id_for_gestionnaire --- app/services/dossier_search_service.rb | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/app/services/dossier_search_service.rb b/app/services/dossier_search_service.rb index 38ce56610..5c735bb52 100644 --- a/app/services/dossier_search_service.rb +++ b/app/services/dossier_search_service.rb @@ -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