[#2179] Simplify matching_dossiers_for_gestionnaire

This commit is contained in:
Frederic Merizen 2018-07-31 14:56:21 +02:00
parent 8744e9b83d
commit 8fc359c54d

View file

@ -1,14 +1,7 @@
class DossierSearchService class DossierSearchService
def self.matching_dossiers_for_gestionnaire(search_terms, gestionnaire) def self.matching_dossiers_for_gestionnaire(search_terms, gestionnaire)
# exact id match? dossier_by_exact_id_for_gestionnaire(search_terms, gestionnaire)
dossiers = dossier_by_exact_id_for_gestionnaire(search_terms, gestionnaire) .presence || dossier_by_full_text_for_gestionnaire(search_terms, gestionnaire)
# full text search
if dossiers.empty?
dossier = dossier_by_full_text_for_gestionnaire(search_terms, gestionnaire)
end
dossiers
end end
private private