move child? method for clarity
This commit is contained in:
parent
54132df77d
commit
3fef831524
4 changed files with 7 additions and 8 deletions
|
@ -57,7 +57,7 @@ module DossierChampsConcern
|
|||
revision
|
||||
.types_de_champ
|
||||
.filter { _1.stable_id.in?(stable_ids) }
|
||||
.filter { !revision.child?(_1) }
|
||||
.filter { !_1.child?(revision) }
|
||||
.map { _1.repetition? ? project_champ(_1, nil) : champ_for_update(_1, nil, updated_by: nil) }
|
||||
end
|
||||
|
||||
|
@ -129,7 +129,7 @@ module DossierChampsConcern
|
|||
end
|
||||
|
||||
def check_valid_row_id?(type_de_champ, row_id)
|
||||
if revision.child?(type_de_champ)
|
||||
if type_de_champ.child?(revision)
|
||||
if row_id.blank?
|
||||
raise "type_de_champ #{type_de_champ.stable_id} must have a row_id because it is part of a repetition"
|
||||
end
|
||||
|
|
|
@ -19,7 +19,7 @@ module DossierSectionsConcern
|
|||
end
|
||||
|
||||
def auto_numbering_section_headers_for?(type_de_champ)
|
||||
return false if revision.child?(type_de_champ)
|
||||
return false if type_de_champ.child?(revision)
|
||||
|
||||
sections_for(type_de_champ)&.none? { _1.libelle =~ /^\d/ }
|
||||
end
|
||||
|
|
|
@ -219,11 +219,6 @@ class ProcedureRevision < ApplicationRecord
|
|||
.find { _1.type_de_champ_id == tdc.id }.parent&.type_de_champ
|
||||
end
|
||||
|
||||
def child?(tdc)
|
||||
revision_types_de_champ
|
||||
.find { _1.type_de_champ_id == tdc.id }&.child?
|
||||
end
|
||||
|
||||
def remove_children_of(tdc)
|
||||
children_of(tdc).each do |child|
|
||||
remove_type_de_champ(child.stable_id)
|
||||
|
|
|
@ -456,6 +456,10 @@ class TypeDeChamp < ApplicationRecord
|
|||
!private?
|
||||
end
|
||||
|
||||
def child?(revision)
|
||||
revision.revision_types_de_champ.find { _1.type_de_champ_id == id }&.child?
|
||||
end
|
||||
|
||||
def filename_for_attachement(attachment_sym)
|
||||
attachment = send(attachment_sym)
|
||||
if attachment.attached?
|
||||
|
|
Loading…
Reference in a new issue