From 3ef6f450da50e44ccd8fda806a12a9f82a8dd378 Mon Sep 17 00:00:00 2001 From: Paul Chavard Date: Thu, 22 Aug 2024 17:38:04 +0200 Subject: [PATCH] cleanup: more concistent methods usage --- app/models/dossier.rb | 4 ++-- app/models/procedure_revision_type_de_champ.rb | 4 ++-- .../dossiers/_instruction_button_motivation.html.haml | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/app/models/dossier.rb b/app/models/dossier.rb index 2227a58e2..f1df102e0 100644 --- a/app/models/dossier.rb +++ b/app/models/dossier.rb @@ -932,7 +932,7 @@ class Dossier < ApplicationRecord end def remove_titres_identite! - champs_public.filter(&:titre_identite?).map(&:piece_justificative_file).each(&:purge_later) + champs.filter(&:titre_identite?).map(&:piece_justificative_file).each(&:purge_later) end def remove_piece_justificative_file_not_visible! @@ -1147,7 +1147,7 @@ class Dossier < ApplicationRecord end def has_annotations? - revision.revision_types_de_champ_private.present? + revision.types_de_champ_private.present? end def hide_info_with_accuse_lecture? diff --git a/app/models/procedure_revision_type_de_champ.rb b/app/models/procedure_revision_type_de_champ.rb index 503595143..b8e538c97 100644 --- a/app/models/procedure_revision_type_de_champ.rb +++ b/app/models/procedure_revision_type_de_champ.rb @@ -32,8 +32,8 @@ class ProcedureRevisionTypeDeChamp < ApplicationRecord end def siblings - if parent_id.present? - revision.revision_types_de_champ.where(parent_id: parent_id).ordered + if child? + revision.revision_types_de_champ.where(parent_id:).ordered elsif private? revision.revision_types_de_champ_private else diff --git a/app/views/instructeurs/dossiers/_instruction_button_motivation.html.haml b/app/views/instructeurs/dossiers/_instruction_button_motivation.html.haml index 76b4d576e..56c83c685 100644 --- a/app/views/instructeurs/dossiers/_instruction_button_motivation.html.haml +++ b/app/views/instructeurs/dossiers/_instruction_button_motivation.html.haml @@ -12,7 +12,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_annotations_privees, unspecified_champs = unspecified_attestation_champs.partition(&:private) + - unspecified_annotations_privees, unspecified_champs = unspecified_attestation_champs.partition(&:private?) - if unspecified_champs.present? %h4 Champs de la demande