fix(repetition): don't fail when trying to add a row of repetition without champ

Cf procedure#31063 which have stable_id#1078289 without children
This commit is contained in:
Colin Darie 2024-04-15 13:15:18 +02:00
parent bde496b739
commit 4da13f5dc2

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