use column.options_for_select

This commit is contained in:
simon lehericey 2024-11-06 11:55:59 +01:00
parent 92e29c6e13
commit f8dc1d1533
No known key found for this signature in database
GPG key ID: CDE670D827C7B3C5

View file

@ -58,18 +58,12 @@ class Instructeurs::ColumnFilterValueComponent < ApplicationComponent
Procedure.find(procedure_id).labels.filter_map do
[_1.name, _1.id]
end
elsif column.is_a?(Columns::ChampColumn)
column.options_for_select
else
find_type_de_champ(column.stable_id).options_for_select(column)
[]
end
end
def find_type_de_champ(stable_id)
TypeDeChamp
.joins(:revision_types_de_champ)
.where(revision_types_de_champ: { revision_id: ProcedureRevision.where(procedure_id:) })
.order(created_at: :desc)
.find_by(stable_id:)
end
def procedure_id = @column.h_id[:procedure_id]
end