fix display in view and export if answer is 'no'

This commit is contained in:
Lisa Durand 2023-03-22 11:56:52 +01:00
parent a01564adcd
commit aa9c94a20e
4 changed files with 7 additions and 3 deletions

View file

@ -212,7 +212,7 @@ def add_avis(pdf, avis)
format_in_2_lines(pdf, "Avis de #{avis.email_to_display}#{avis.confidentiel? ? ' (confidentiel)' : ''}",
avis.answer || 'En attente de réponse')
if avis.question_answer.present?
if [true, false].include? avis.question_answer
format_in_2_columns(pdf, "Réponse oui/non ", t("question_answer.#{avis.question_answer}", scope: 'helpers.label'))
end
end

View file

@ -37,6 +37,6 @@
- if avis.piece_justificative_file.attached?
= render Attachment::ShowComponent.new(attachment: avis.piece_justificative_file.attachment)
.answer-body
- if avis.question_answer
- if [true, false].include? avis.question_answer
%p= t("question_answer.#{avis.question_answer}", scope: 'helpers.label')
= render SimpleFormatComponent.new(avis.answer, allow_a: false)

View file

@ -53,7 +53,7 @@
- if avis.piece_justificative_file.attached?
= render Attachment::ShowComponent.new(attachment: avis.piece_justificative_file.attachment)
.answer-body
- if avis.question_answer
- if [true, false].include? avis.question_answer
%p= t("question_answer.#{avis.question_answer}", scope: 'helpers.label')
= render SimpleFormatComponent.new(avis.answer, allow_a: false)

View file

@ -110,6 +110,10 @@ describe 'Inviting an expert:' do
expect(page).to have_content('Ma réponse dexpert.')
expect(page).to have_content('non')
click_on 'Voir les avis'
expect(page).to have_text('Vous')
expect(page).to have_text('non')
within('.breadcrumbs') { click_on 'Avis' }
expect(page).to have_text('1 avis donné')
end