Merge pull request #10325 from colinux/fix-add-row-without-champ

Tech: pas d'erreur si un usager essaie d'ajouter une ligne d'un champ répétition sans enfant
This commit is contained in:
Paul Chavard 2024-04-15 11:48:04 +00:00 committed by GitHub
commit 7163571764
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -6,7 +6,7 @@ class Champs::RepetitionController < ApplicationController
row = @champ.add_row(@champ.dossier.revision)
@first_champ_id = row.map(&:focusable_input_id).compact.first
@row_id = row.first&.row_id
@row_number = @champ.row_ids.find_index(@row_id) + 1
@row_number = @row_id.nil? ? 0 : @champ.row_ids.find_index(@row_id) + 1
end
def remove