refactor(dossier): make new methods arguments named
This commit is contained in:
parent
436caa2305
commit
9b26dedab4
8 changed files with 18 additions and 18 deletions
|
@ -42,10 +42,10 @@ module DossierCloneConcern
|
|||
end
|
||||
|
||||
def make_diff(editing_fork)
|
||||
origin_champs_index = champs_for_revision(:public).index_by(&:stable_id_with_row)
|
||||
forked_champs_index = editing_fork.champs_for_revision(:public).index_by(&:stable_id_with_row)
|
||||
origin_champs_index = champs_for_revision(scope: :public).index_by(&:stable_id_with_row)
|
||||
forked_champs_index = editing_fork.champs_for_revision(scope: :public).index_by(&:stable_id_with_row)
|
||||
updated_champs_index = editing_fork
|
||||
.champs_for_revision(:public)
|
||||
.champs_for_revision(scope: :public)
|
||||
.filter { _1.updated_at > editing_fork.created_at }
|
||||
.index_by(&:stable_id_with_row)
|
||||
|
||||
|
@ -142,7 +142,7 @@ module DossierCloneConcern
|
|||
end
|
||||
|
||||
def apply_diff(diff)
|
||||
champs_index = (champs_for_revision(:public) + diff[:added]).index_by(&:stable_id_with_row)
|
||||
champs_index = (champs_for_revision(scope: :public) + diff[:added]).index_by(&:stable_id_with_row)
|
||||
|
||||
diff[:added].each do |champ|
|
||||
if champ.child?
|
||||
|
|
|
@ -6,11 +6,11 @@ module DossierSectionsConcern
|
|||
@sections = Hash.new do |hash, parent|
|
||||
case parent
|
||||
when :public
|
||||
hash[parent] = champs_for_revision(:public, true).filter(&:header_section?)
|
||||
hash[parent] = champs_for_revision(scope: :public, root: true).filter(&:header_section?)
|
||||
when :private
|
||||
hash[parent] = champs_for_revision(:private, true).filter(&:header_section?)
|
||||
hash[parent] = champs_for_revision(scope: :private, root: true).filter(&:header_section?)
|
||||
else
|
||||
hash[parent] = champs_for_revision(parent.type_de_champ).filter(&:header_section?)
|
||||
hash[parent] = champs_for_revision(scope: parent.type_de_champ).filter(&:header_section?)
|
||||
end
|
||||
end
|
||||
@sections[champ.parent || (champ.public? ? :public : :private)]
|
||||
|
@ -23,7 +23,7 @@ module DossierSectionsConcern
|
|||
end
|
||||
|
||||
def index_for_section_header(champ)
|
||||
champs = champ.private? ? champs_for_revision(:private, true) : champs_for_revision(:public, true)
|
||||
champs = champ.private? ? champs_for_revision(scope: :private, root: true) : champs_for_revision(scope: :public, root: true)
|
||||
index = 1
|
||||
champs.each do |c|
|
||||
if c.repetition?
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue