use champ_column.stable_id

This commit is contained in:
simon lehericey 2024-10-31 18:35:20 +01:00
parent 74e6834ce2
commit 8507733250
No known key found for this signature in database
GPG key ID: CDE670D827C7B3C5
2 changed files with 4 additions and 7 deletions

View file

@ -54,12 +54,11 @@ class Instructeurs::ColumnFilterValueComponent < ApplicationComponent
end
end
else
find_type_de_champ(column.column).options_for_select(column)
find_type_de_champ(column.stable_id).options_for_select(column)
end
end
def find_type_de_champ(column)
stable_id = column.to_s.split('->').first
def find_type_de_champ(stable_id)
TypeDeChamp
.joins(:revision_types_de_champ)
.where(revision_types_de_champ: { revision_id: ProcedureRevision.where(procedure_id:) })

View file

@ -49,7 +49,7 @@ class Instructeurs::FilterButtonsComponent < ApplicationComponent
column, filter = filter_column.column, filter_column.filter
if column.type_de_champ?
find_type_de_champ(column.column).dynamic_type.filter_to_human(filter)
find_type_de_champ(column.stable_id).dynamic_type.filter_to_human(filter)
elsif column.dossier_state?
if filter == 'pending_correction'
Dossier.human_attribute_name("pending_correction.for_instructeur")
@ -66,9 +66,7 @@ class Instructeurs::FilterButtonsComponent < ApplicationComponent
end
end
def find_type_de_champ(column)
stable_id = column.to_s.split('->').first
def find_type_de_champ(stable_id)
TypeDeChamp
.joins(:revision_types_de_champ)
.where(revision_types_de_champ: { revision_id: @procedure_presentation.procedure.revisions })