Merge pull request #8828 from colinux/fix-manager-dossier-created-at
Fix (manager): ne trie pas par created_at pour ne pas casser la prod
This commit is contained in:
commit
690c7aee80
4 changed files with 13 additions and 1 deletions
|
@ -5,7 +5,7 @@ module Manager
|
|||
|
||||
def default_params
|
||||
request.query_parameters[resource_name] ||= {
|
||||
order: "created_at",
|
||||
order: "id",
|
||||
direction: "desc"
|
||||
}
|
||||
end
|
||||
|
@ -24,6 +24,15 @@ module Manager
|
|||
|
||||
private
|
||||
|
||||
def sorting_attribute
|
||||
attribute = super
|
||||
|
||||
# do not sort by non-indexed created_at. This require a full table scan, locking every other transactions.
|
||||
return :id if attribute.to_sym == :created_at
|
||||
|
||||
attribute
|
||||
end
|
||||
|
||||
# private method called by rails fwk
|
||||
# see https://github.com/roidrage/lograge
|
||||
def append_info_to_payload(payload)
|
||||
|
|
|
@ -24,6 +24,7 @@ class AdministrateurDashboard < Administrate::BaseDashboard
|
|||
# By default, it's limited to four items to reduce clutter on index pages.
|
||||
# Feel free to add, remove, or rearrange items.
|
||||
COLLECTION_ATTRIBUTES = [
|
||||
:id,
|
||||
:user,
|
||||
:created_at,
|
||||
:procedures,
|
||||
|
|
|
@ -23,6 +23,7 @@ class InstructeurDashboard < Administrate::BaseDashboard
|
|||
# By default, it's limited to four items to reduce clutter on index pages.
|
||||
# Feel free to add, remove, or rearrange items.
|
||||
COLLECTION_ATTRIBUTES = [
|
||||
:id,
|
||||
:user,
|
||||
:created_at
|
||||
].freeze
|
||||
|
|
|
@ -23,6 +23,7 @@ class UserDashboard < Administrate::BaseDashboard
|
|||
# By default, it's limited to four items to reduce clutter on index pages.
|
||||
# Feel free to add, remove, or rearrange items.
|
||||
COLLECTION_ATTRIBUTES = [
|
||||
:id,
|
||||
:email,
|
||||
:created_at
|
||||
].freeze
|
||||
|
|
Loading…
Reference in a new issue