Fixed sorting with null values #130
This commit is contained in:
parent
7193e58ba1
commit
6149825101
@ -3,8 +3,6 @@ import functools
|
|||||||
from cpl_core.utils import String
|
from cpl_core.utils import String
|
||||||
from cpl_query.extension import List
|
from cpl_query.extension import List
|
||||||
|
|
||||||
from bot_api.exception.service_error_code_enum import ServiceErrorCode
|
|
||||||
from bot_api.exception.service_exception import ServiceException
|
|
||||||
from bot_graphql.abc.filter_abc import FilterABC
|
from bot_graphql.abc.filter_abc import FilterABC
|
||||||
|
|
||||||
|
|
||||||
@ -32,9 +30,7 @@ class Sort(FilterABC):
|
|||||||
def _by_column(self, x):
|
def _by_column(self, x):
|
||||||
atr = self._rgetattr(x, String.convert_to_snake_case(self._sort_column), None)
|
atr = self._rgetattr(x, String.convert_to_snake_case(self._sort_column), None)
|
||||||
if atr is None:
|
if atr is None:
|
||||||
raise ServiceException(
|
return ""
|
||||||
ServiceErrorCode.InvalidData, f"Attribute {self._sort_column} in object of {type(x)} not found"
|
|
||||||
)
|
|
||||||
return atr
|
return atr
|
||||||
|
|
||||||
def filter(self, query: List, *args) -> List:
|
def filter(self, query: List, *args) -> List:
|
||||||
|
Loading…
Reference in New Issue
Block a user