From cc19453f681c299f46dc4bcb538b9b350095f2bf Mon Sep 17 00:00:00 2001
From: maatinito <15379878+maatinito@users.noreply.github.com>
Date: Tue, 23 Mar 2021 12:45:55 +0000
Subject: [PATCH 1/3] views: fix warning message about incomplete fields for
attestation
The labels for the champs and private champs were inverted.
---
.../dossiers/_state_button_motivation.html.haml | 2 +-
.../_state_button_motivation.html.haml_spec.rb | 15 +++++++++------
2 files changed, 10 insertions(+), 7 deletions(-)
diff --git a/app/views/instructeurs/dossiers/_state_button_motivation.html.haml b/app/views/instructeurs/dossiers/_state_button_motivation.html.haml
index 7376dceca..b495a162e 100644
--- a/app/views/instructeurs/dossiers/_state_button_motivation.html.haml
+++ b/app/views/instructeurs/dossiers/_state_button_motivation.html.haml
@@ -16,7 +16,7 @@
- if unspecified_attestation_champs.present?
.warning
Attention, les valeurs suivantes n'ont pas été renseignées mais sont nécessaires pour pouvoir envoyer une attestation valide :
- - unspecified_champs, unspecified_annotations_privees = unspecified_attestation_champs.partition(&:private)
+ - unspecified_annotations_privees, unspecified_champs = unspecified_attestation_champs.partition(&:private)
- if unspecified_champs.present?
%h4 Champs de la demande
diff --git a/spec/views/instructeur/dossiers/_state_button_motivation.html.haml_spec.rb b/spec/views/instructeur/dossiers/_state_button_motivation.html.haml_spec.rb
index e02e37d14..dbcaa7920 100644
--- a/spec/views/instructeur/dossiers/_state_button_motivation.html.haml_spec.rb
+++ b/spec/views/instructeur/dossiers/_state_button_motivation.html.haml_spec.rb
@@ -1,7 +1,7 @@
describe 'instructeurs/dossiers/state_button_motivation.html.haml', type: :view do
let(:dossier) { create(:dossier, :en_instruction) }
- subject! do
+ subject do
render(
'instructeurs/dossiers/state_button_motivation.html.haml',
dossier: dossier,
@@ -14,12 +14,15 @@ describe 'instructeurs/dossiers/state_button_motivation.html.haml', type: :view
)
end
- context 'with an attestation preview' do
- let(:dossier) { create :dossier, :accepte, :with_attestation }
- it { expect(rendered).to have_link(href: apercu_attestation_instructeur_dossier_path(dossier.procedure, dossier)) }
+ context 'without attestation' do
+ it { expect(subject).not_to have_link(href: apercu_attestation_instructeur_dossier_path(dossier.procedure, dossier)) }
end
- context 'without an attestation preview' do
- it { expect(rendered).not_to have_link(href: apercu_attestation_instructeur_dossier_path(dossier.procedure, dossier)) }
+ context 'with an attestation' do
+ let(:dossier) { create :dossier, :accepte, :with_attestation }
+
+ it 'includes a link to preview the attestation' do
+ expect(subject).to have_link(href: apercu_attestation_instructeur_dossier_path(dossier.procedure, dossier))
+ end
end
end
From a29fb5cc5bf84f7f69f2d78d5b5429eb8f53d1db Mon Sep 17 00:00:00 2001
From: maatinito <15379878+maatinito@users.noreply.github.com>
Date: Tue, 23 Mar 2021 14:04:45 +0000
Subject: [PATCH 2/3] dossier pdf: display form fields in two columns (instead
of 2 lines)
Identity fields are displayed on two columns, but until now Dossier
fields were displayed on two lines.
This was because of a bug in format_in_2_columns, where the multiple-
lines fields were not handled properly.
This has been fixed a while back by @maatinito, so we can now enable
two-columns formatting even for Dossier fields.
---
app/views/dossiers/show.pdf.prawn | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/app/views/dossiers/show.pdf.prawn b/app/views/dossiers/show.pdf.prawn
index 2c7bdf02f..8b6a4b4d3 100644
--- a/app/views/dossiers/show.pdf.prawn
+++ b/app/views/dossiers/show.pdf.prawn
@@ -93,9 +93,9 @@ def render_single_champ(pdf, champ)
end
pdf.text "\n"
when 'Champs::ExplicationChamp'
- format_in_2_lines(pdf, champ.libelle, champ.description)
+ format_in_2_columns(pdf, champ.libelle, champ.description)
when 'Champs::CarteChamp'
- format_in_2_lines(pdf, champ.libelle, champ.to_feature_collection.to_json)
+ format_in_2_columns(pdf, champ.libelle, champ.to_feature_collection.to_json)
when 'Champs::SiretChamp'
pdf.font 'marianne', style: :bold, size: 9 do
pdf.text champ.libelle
@@ -105,10 +105,10 @@ def render_single_champ(pdf, champ)
pdf.text "\n"
when 'Champs::NumberChamp'
value = number_with_delimiter(champ.to_s)
- format_in_2_lines(pdf, champ.libelle, value)
+ format_in_2_columns(pdf, champ.libelle, value)
else
value = champ.to_s.empty? ? 'Non communiqué' : champ.to_s
- format_in_2_lines(pdf, champ.libelle, value)
+ format_in_2_columns(pdf, champ.libelle, value)
end
end
@@ -181,7 +181,7 @@ prawn_document(page_size: "A4") do |pdf|
pdf.text "Ce dossier est #{dossier_display_state(@dossier, lower: true)}.", inline_format: true
pdf.text "\n"
if @dossier.motivation.present?
- format_in_2_lines(pdf, "Motif de la décision", @dossier.motivation)
+ format_in_2_columns(pdf, "Motif de la décision", @dossier.motivation)
end
add_title(pdf, 'Historique')
add_etats_dossier(pdf, @dossier)
From fdc6521d0209788dbfcfcb99e31fbdbb5ccc85e1 Mon Sep 17 00:00:00 2001
From: kara Diaby
Date: Wed, 24 Mar 2021 09:17:22 +0100
Subject: [PATCH 3/3] After party task to backfill experts_procedure_id on avis
table
---
...2_backfill_experts_procedure_id_on_avis_table.rake} | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
rename lib/tasks/deployment/{20210322162751_backfill_experts_procedure_on_avis_2.rake => 20210324081552_backfill_experts_procedure_id_on_avis_table.rake} (80%)
diff --git a/lib/tasks/deployment/20210322162751_backfill_experts_procedure_on_avis_2.rake b/lib/tasks/deployment/20210324081552_backfill_experts_procedure_id_on_avis_table.rake
similarity index 80%
rename from lib/tasks/deployment/20210322162751_backfill_experts_procedure_on_avis_2.rake
rename to lib/tasks/deployment/20210324081552_backfill_experts_procedure_id_on_avis_table.rake
index baba92802..90a1ffa3f 100644
--- a/lib/tasks/deployment/20210322162751_backfill_experts_procedure_on_avis_2.rake
+++ b/lib/tasks/deployment/20210324081552_backfill_experts_procedure_id_on_avis_table.rake
@@ -1,10 +1,10 @@
namespace :after_party do
- desc 'Deployment task: backfill_experts_procedure_on_avis_2'
- task backfill_experts_procedure_on_avis_2: :environment do
- puts "Running deploy task 'backfill_experts_procedure_on_avis_2'"
+ desc 'Deployment task: backfill_experts_procedure_id_on_avis_table'
+ task backfill_experts_procedure_id_on_avis_table: :environment do
+ puts "Running deploy task 'backfill_experts_procedure_id_on_avis_table'"
- without_instructeur = Avis.where(experts_procedure_id: nil, answer: nil, instructeur_id: nil).where.not(email: nil)
- with_instructeur = Avis.where(experts_procedure_id: nil, answer: nil, email: nil).where.not(instructeur_id: nil)
+ without_instructeur = Avis.where(experts_procedure_id: nil, instructeur_id: nil).where.not(email: nil)
+ with_instructeur = Avis.where(experts_procedure_id: nil, email: nil).where.not(instructeur_id: nil)
progress = ProgressReport.new(without_instructeur.count)
progress2 = ProgressReport.new(with_instructeur.count)