refactor: renaming

This commit is contained in:
simon lehericey 2024-04-26 15:04:34 +02:00
parent 6445337be7
commit c8b3b4b45a
No known key found for this signature in database
GPG key ID: CDE670D827C7B3C5
6 changed files with 9 additions and 9 deletions

View file

@ -79,7 +79,7 @@ module Instructeurs
end
def set_all_pj
@all_pj ||= @procedure.pieces_jointes_exportables_list
@all_pj ||= @procedure.exportables_pieces_jointes
end
def export_params

View file

@ -3,17 +3,17 @@ module PiecesJointesListConcern
included do
def public_wrapped_partionned_pjs
pieces_jointes_list(public_only: true, wrap_with_parent: true)
pieces_jointes(public_only: true, wrap_with_parent: true)
.partition { |(pj, _)| pj.condition.nil? }
end
def pieces_jointes_exportables_list
pieces_jointes_list(exclude_titre_identite: true)
def exportables_pieces_jointes
pieces_jointes(exclude_titre_identite: true)
end
private
def pieces_jointes_list(
def pieces_jointes(
exclude_titre_identite: false,
public_only: false,
wrap_with_parent: false

View file

@ -13,7 +13,7 @@ class ExportTemplate < ApplicationRecord
content["pdf_name"] = tiptap_json("export_")
content["pjs"] = []
procedure.pieces_jointes_exportables_list.each do |pj|
procedure.exportables_pieces_jointes.each do |pj|
content["pjs"] << { "stable_id" => pj.stable_id.to_s, "path" => tiptap_json("#{pj.libelle.parameterize}-") }
end
end

View file

@ -38,7 +38,7 @@ class ExportTemplateValidator < ActiveModel::Validator
def validate_pjs(record)
record.content["pjs"]&.each do |pj|
pj_sym = pj.symbolize_keys
libelle = record.groupe_instructeur.procedure.pieces_jointes_exportables_list.find { _1.stable_id.to_s == pj_sym[:stable_id] }&.libelle&.to_sym
libelle = record.groupe_instructeur.procedure.exportables_pieces_jointes.find { _1.stable_id.to_s == pj_sym[:stable_id] }&.libelle&.to_sym
validate_content(record, pj_sym[:path], libelle)
end
end

View file

@ -82,7 +82,7 @@
%span#preview_default_dossier_directory= @export_template.tiptap_convert(sample_dossier, "default_dossier_directory")
%ul
%li#preview_pdf_name= @export_template.tiptap_convert(sample_dossier, "pdf_name")
- @procedure.pieces_jointes_exportables_list.each do |pj|
- @procedure.exportables_pieces_jointes.each do |pj|
%li{ id: "preview_pj_#{pj.stable_id}" }= @export_template.tiptap_convert_pj(sample_dossier, pj.stable_id)
%ul
%li

View file

@ -44,7 +44,7 @@ describe PiecesJointesListConcern do
end
it "returns the list of pieces jointes with private, without parent repetition, without titre identite" do
expect(procedure.pieces_jointes_exportables_list.map(&:libelle)).to match_array([pj1, pj2, pjcond, pj5, pjcond2, pj6].map(&:libelle))
expect(procedure.exportables_pieces_jointes.map(&:libelle)).to match_array([pj1, pj2, pjcond, pj5, pjcond2, pj6].map(&:libelle))
end
end
end