update_displayed_fields can use sorted_column

This commit is contained in:
simon lehericey 2024-10-08 13:03:40 +02:00
parent 4f0cac251d
commit 249ddf291f
No known key found for this signature in database
GPG key ID: CDE670D827C7B3C5

View file

@ -140,9 +140,8 @@ class ProcedurePresentation < ApplicationRecord
displayed_columns: columns.map(&:h_id) displayed_columns: columns.map(&:h_id)
) )
if !sort_to_column_id(sort).in?(column_ids) if !sorted_column.column.in?(columns)
default_column_id = procedure.dossier_id_column.id update(sorted_column: nil)
update_sort(default_column_id, "desc")
end end
end end
@ -265,11 +264,6 @@ class ProcedurePresentation < ApplicationRecord
end.reduce(:&) end.reduce(:&)
end end
# type_de_champ/4373429
def sort_to_column_id(sort)
[sort[TABLE], sort[COLUMN]].join(SLASH)
end
def find_type_de_champ(column) def find_type_de_champ(column)
TypeDeChamp TypeDeChamp
.joins(:revision_types_de_champ) .joins(:revision_types_de_champ)