export cache_key based on column

This commit is contained in:
simon lehericey 2024-10-15 10:19:48 +02:00
parent 954d232a47
commit b5ed8c9b61
No known key found for this signature in database
GPG key ID: CDE670D827C7B3C5
4 changed files with 20 additions and 12 deletions

View file

@ -8,7 +8,10 @@ FactoryBot.define do
groupe_instructeurs { [association(:groupe_instructeur)] }
after(:build) do |export, _evaluator|
export.key = Export.generate_cache_key(export.groupe_instructeurs.map(&:id), export.procedure_presentation)
procedure_presentation = export.procedure_presentation
filters = Array.wrap(procedure_presentation&.filters_for(export.statut))
sorted_column = procedure_presentation&.sorted_column
export.key = Export.generate_cache_key(export.groupe_instructeurs.map(&:id), filters, sorted_column)
export.user_profile = export.groupe_instructeurs.first&.instructeurs&.first if export.user_profile.nil?
export.dossiers_count = 10 if !export.pending?
end