refactor(dossier): predicates methods must return boolean

This commit is contained in:
Colin Darie 2024-12-10 15:52:17 +01:00
parent a54f022353
commit f6366a9cd3
No known key found for this signature in database
GPG key ID: 4FB865FDBCA4BCC4

View file

@ -38,16 +38,16 @@ module DossierCloneConcern
end end
def forked_with_changes? def forked_with_changes?
if forked_diff.present? return false if forked_diff.blank?
forked_diff.values.any?(&:present?) || forked_groupe_instructeur_changed? forked_diff.values.any?(&:present?) || forked_groupe_instructeur_changed?
end end
end
def champ_forked_with_changes?(champ) def champ_forked_with_changes?(champ)
if forked_diff.present? return false if forked_diff.blank?
forked_diff.values.any? { |champs| champs.any? { _1.public_id == champ.public_id } } forked_diff.values.any? { |champs| champs.any? { _1.public_id == champ.public_id } }
end end
end
def make_diff(editing_fork) def make_diff(editing_fork)
origin_champs_index = project_champs_public_all.index_by(&:public_id) origin_champs_index = project_champs_public_all.index_by(&:public_id)