Merge pull request #5127 from betagouv/5125-bug-depot-avis

Corrige l'erreur 404 sur les avis. Permet aux experts de consulter les bilans bdf
This commit is contained in:
krichtof 2020-05-11 13:14:41 +02:00 committed by GitHub
commit 92efdafe44
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 19 additions and 1 deletions

View file

@ -72,6 +72,14 @@ module Instructeurs
end
end
def bilans_bdf
if avis.dossier.etablissement&.entreprise_bilans_bdf_to_csv.present?
render csv: avis.dossier.etablissement.entreprise_bilans_bdf_to_csv
else
redirect_to instructeur_avis_path(avis)
end
end
def sign_up
@email = params[:email]
@dossier = Avis.includes(:dossier).find(params[:id]).dossier

View file

@ -83,7 +83,10 @@
%th.libelle
Bilans Banque de France
= "en #{etablissement.entreprise_bilans_bdf_monnaie}"
%td= link_to "Consulter les bilans", bilans_bdf_instructeur_dossier_path
- if controller.is_a?(Instructeurs::AvisController)
%td= link_to "Consulter les bilans", bilans_bdf_instructeur_avis_path(@avis.id)
- else
%td= link_to "Consulter les bilans", bilans_bdf_instructeur_dossier_path(procedure_id: @dossier.procedure.id, dossier_id: @dossier.id)
- if etablissement.association?
%tr

View file

@ -354,6 +354,7 @@ Rails.application.routes.draw do
get 'messagerie'
post 'commentaire' => 'avis#create_commentaire'
post 'avis' => 'avis#create_avis'
get 'bilans_bdf'
get 'sign_up/email/:email' => 'avis#sign_up', constraints: { email: /.*/ }, as: 'sign_up'
post 'sign_up/email/:email' => 'avis#create_instructeur', constraints: { email: /.*/ }

View file

@ -50,6 +50,12 @@ describe Instructeurs::AvisController, type: :controller do
it { expect(assigns(:dossier)).to eq(dossier) }
end
describe '#bilans_bdf' do
before { get :bilans_bdf, params: { id: avis_without_answer.id } }
it { expect(response).to redirect_to(instructeur_avis_path(avis_without_answer)) }
end
describe '#update' do
describe 'without attachment' do
before do