remove dossier.linked_dossiers
This commit is contained in:
parent
0d55743d9f
commit
7afeae1408
4 changed files with 4 additions and 7 deletions
|
@ -584,10 +584,6 @@ class Dossier < ApplicationRecord
|
||||||
!PiecesJustificativesService.liste_pieces_justificatives(self).empty? && PiecesJustificativesService.pieces_justificatives_total_size(self) < Dossier::TAILLE_MAX_ZIP
|
!PiecesJustificativesService.liste_pieces_justificatives(self).empty? && PiecesJustificativesService.pieces_justificatives_total_size(self) < Dossier::TAILLE_MAX_ZIP
|
||||||
end
|
end
|
||||||
|
|
||||||
def linked_dossiers
|
|
||||||
Dossier.where(id: champs.filter(&:dossier_link?).map(&:value).compact)
|
|
||||||
end
|
|
||||||
|
|
||||||
def linked_dossiers_for(instructeur)
|
def linked_dossiers_for(instructeur)
|
||||||
dossier_ids = champs.filter(&:dossier_link?).map(&:value).compact
|
dossier_ids = champs.filter(&:dossier_link?).map(&:value).compact
|
||||||
(instructeur.dossiers.where(id: dossier_ids) + instructeur.dossiers_from_avis.where(id: dossier_ids)).uniq
|
(instructeur.dossiers.where(id: dossier_ids) + instructeur.dossiers_from_avis.where(id: dossier_ids)).uniq
|
||||||
|
|
|
@ -204,7 +204,7 @@ describe Instructeurs::AvisController, type: :controller do
|
||||||
context 'and the expert can access the linked dossiers' do
|
context 'and the expert can access the linked dossiers' do
|
||||||
let(:created_avis) { Avis.last(2).first }
|
let(:created_avis) { Avis.last(2).first }
|
||||||
let(:linked_avis) { Avis.last }
|
let(:linked_avis) { Avis.last }
|
||||||
let(:linked_dossier) { dossier.reload.linked_dossiers.first }
|
let(:linked_dossier) { Dossier.find_by(id: dossier.reload.champs.filter(&:dossier_link?).map(&:value).compact) }
|
||||||
let(:invite_linked_dossiers) do
|
let(:invite_linked_dossiers) do
|
||||||
instructeur.assign_to_procedure(linked_dossier.procedure)
|
instructeur.assign_to_procedure(linked_dossier.procedure)
|
||||||
true
|
true
|
||||||
|
|
|
@ -495,7 +495,7 @@ describe Instructeurs::DossiersController, type: :controller do
|
||||||
context 'and the expert can access the linked dossiers' do
|
context 'and the expert can access the linked dossiers' do
|
||||||
let(:saved_avis) { Avis.last(2).first }
|
let(:saved_avis) { Avis.last(2).first }
|
||||||
let(:linked_avis) { Avis.last }
|
let(:linked_avis) { Avis.last }
|
||||||
let(:linked_dossier) { dossier.reload.linked_dossiers.first }
|
let(:linked_dossier) { Dossier.find_by(id: dossier.reload.champs.filter(&:dossier_link?).map(&:value).compact) }
|
||||||
let(:invite_linked_dossiers) do
|
let(:invite_linked_dossiers) do
|
||||||
instructeur.assign_to_procedure(linked_dossier.procedure)
|
instructeur.assign_to_procedure(linked_dossier.procedure)
|
||||||
true
|
true
|
||||||
|
|
|
@ -9,11 +9,12 @@ feature 'Inviting an expert:' do
|
||||||
let(:expert_password) { 'mot de passe d’expert' }
|
let(:expert_password) { 'mot de passe d’expert' }
|
||||||
let(:procedure) { create(:procedure, :published, instructeurs: [instructeur]) }
|
let(:procedure) { create(:procedure, :published, instructeurs: [instructeur]) }
|
||||||
let(:dossier) { create(:dossier, :en_construction, :with_dossier_link, procedure: procedure) }
|
let(:dossier) { create(:dossier, :en_construction, :with_dossier_link, procedure: procedure) }
|
||||||
|
let(:linked_dossier) { Dossier.find_by(id: dossier.reload.champs.filter(&:dossier_link?).map(&:value).compact) }
|
||||||
|
|
||||||
context 'as an Instructeur' do
|
context 'as an Instructeur' do
|
||||||
scenario 'I can invite an expert' do
|
scenario 'I can invite an expert' do
|
||||||
# assign instructeur to linked dossier
|
# assign instructeur to linked dossier
|
||||||
instructeur.assign_to_procedure(dossier.reload.linked_dossiers.first.procedure)
|
instructeur.assign_to_procedure(linked_dossier.procedure)
|
||||||
|
|
||||||
login_as instructeur.user, scope: :user
|
login_as instructeur.user, scope: :user
|
||||||
visit instructeur_dossier_path(procedure, dossier)
|
visit instructeur_dossier_path(procedure, dossier)
|
||||||
|
|
Loading…
Reference in a new issue