Merge pull request #1257 from betagouv/fix-1199

[Fix #1199] Implement id search for experts
This commit is contained in:
gregoirenovel 2018-01-16 11:08:29 +01:00 committed by GitHub
commit 490a6dee4c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 2 deletions

View file

@ -5,10 +5,14 @@ module NewGestionnaire
# exact id match?
if @search_terms.to_i != 0
@dossiers = current_gestionnaire.dossiers.where(id: @search_terms.to_i)
@dossiers = current_gestionnaire.dossiers.where(id: @search_terms.to_i) +
current_gestionnaire.dossiers_from_avis.where(id: @search_terms.to_i)
@dossiers.uniq!
end
@dossiers = Dossier.none if @dossiers.nil?
if @dossiers.nil?
@dossiers = Dossier.none
end
# full text search
if @dossiers.empty?

View file

@ -10,6 +10,7 @@ class Gestionnaire < ActiveRecord::Base
has_many :followed_dossiers, through: :follows, source: :dossier
has_many :follows
has_many :avis
has_many :dossiers_from_avis, through: :avis, source: :dossier
include CredentialsSyncableConcern