Fixed sorting with null values #130

This commit is contained in:
Sven Heidemann 2023-02-18 13:05:45 +01:00
parent 7193e58ba1
commit 6149825101

View File

@ -3,8 +3,6 @@ import functools
from cpl_core.utils import String
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
@ -32,9 +30,7 @@ class Sort(FilterABC):
def _by_column(self, x):
atr = self._rgetattr(x, String.convert_to_snake_case(self._sort_column), None)
if atr is None:
raise ServiceException(
ServiceErrorCode.InvalidData, f"Attribute {self._sort_column} in object of {type(x)} not found"
)
return ""
return atr
def filter(self, query: List, *args) -> List: