it displays a message if instructor is looking for a dossier that is not in his instructor group

This commit is contained in:
Lisa Durand 2022-11-03 17:39:12 +01:00 committed by mfo
parent bb96c3a77d
commit ba0799b684
5 changed files with 41 additions and 0 deletions

View file

@ -28,6 +28,15 @@ class RechercheController < ApplicationController
@dossiers_count = matching_dossiers_ids.count
@followed_dossiers_id = current_instructeur&.followed_dossiers&.where(id: @paginated_ids)&.ids || []
@dossier_avis_ids_h = current_expert&.avis&.where(dossier_id: @paginated_ids)&.pluck(:dossier_id, :id).to_h || {}
# we want to retrieve dossiers that are not accessible to the instructor because he is not in the instructor group
# to display an alert in the view
instructeur_procedure_dossiers_ids = DossierSearchService
.matching_dossiers(current_instructeur&.procedures&.map(&:dossiers)&.first, @search_terms, with_annotation: true)
not_in_instructor_group_dossiers_ids = instructeur_procedure_dossiers_ids - matching_dossiers_ids
@not_in_instructor_group_dossiers = Dossier.where(id: not_in_instructor_group_dossiers_ids)
end
private