mirror of
https://github.com/clearml/clearml-server
synced 2025-01-31 10:56:48 +00:00
Make sure id
field is included in ordering
This commit is contained in:
parent
58d9a64537
commit
9e0adc77dd
@ -522,6 +522,8 @@ class GetMixin(PropsMixin):
|
||||
def validate_order_by(cls, parameters, search_text) -> Sequence:
|
||||
"""
|
||||
Validate and extract order_by params as a list
|
||||
If ordering is specified then make sure that id field is part of it
|
||||
This guarantees the unique order when paging
|
||||
"""
|
||||
order_by = parameters.get(cls._ordering_key)
|
||||
if not order_by:
|
||||
@ -534,6 +536,9 @@ class GetMixin(PropsMixin):
|
||||
"text score cannot be used in order_by when search text is not used"
|
||||
)
|
||||
|
||||
if not any(id_field in order_by for id_field in ("id", "-id")):
|
||||
order_by.append("id")
|
||||
|
||||
return order_by
|
||||
|
||||
@classmethod
|
||||
|
Loading…
Reference in New Issue
Block a user