feature: type_de_champ_controller
This commit is contained in:
parent
2da0aa6525
commit
2fee0ddfd4
9 changed files with 181 additions and 47 deletions
|
@ -197,6 +197,14 @@ class ProcedureRevision < ApplicationRecord
|
|||
revision_types_de_champ.find_by!(type_de_champ: tdc)
|
||||
end
|
||||
|
||||
def upper_coordinates(position)
|
||||
revision_types_de_champ_public.filter { |c| c.position < position }
|
||||
end
|
||||
|
||||
def coordinates_starting_at(position)
|
||||
revision_types_de_champ_public.reload.filter { |c| position <= c.position }
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def compute_estimated_fill_duration
|
||||
|
@ -482,7 +490,8 @@ class ProcedureRevision < ApplicationRecord
|
|||
types_de_champ_public
|
||||
.map.with_index
|
||||
.filter_map { |tdc, i| tdc.condition.present? ? [tdc, i] : nil }
|
||||
.flat_map { |tdc, i| tdc.condition.errors(stable_ids.take(i)) }
|
||||
.each { |message| errors.add(:condition, message) }
|
||||
.map { |tdc, i| [tdc, tdc.condition.errors(stable_ids.take(i))] }
|
||||
.filter { |_tdc, errors| errors.present? }
|
||||
.each { |tdc, message| errors.add(:condition, message, type_de_champ: tdc) }
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue