Merge pull request #9886 from colinux/export-ff-active-revision-first

Tech exports: feature flat pour trier les colonnes par révision récente puis position plutôt que mélanger les révisions entre elles
This commit is contained in:
Colin Darie 2024-01-22 12:21:32 +00:00 committed by GitHub
commit 2f53a017b4
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -104,8 +104,13 @@ class Procedure < ApplicationRecord
TypeDeChamp
.joins(:revision_types_de_champ)
.where(revision_types_de_champ: { id: recents_prtdc })
.order(:private, :position, 'revision_types_de_champ.revision_id': :desc)
.where(revision_types_de_champ: { id: recents_prtdc }).then do |relation|
if feature_enabled?(:export_order_by_revision) # Fonds Verts, en attente d'exports personnalisables
relation.order(:private, 'revision_types_de_champ.revision_id': :desc, position: :asc)
else
relation.order(:private, :position, 'revision_types_de_champ.revision_id': :desc)
end
end
end
end