Skip to content
Snippets Groups Projects
Verified Commit 29d8e150 authored by Timm Fitschen's avatar Timm Fitschen
Browse files

Sorting

parent ee5a131c
No related branches found
No related tags found
No related merge requests found
...@@ -43,7 +43,6 @@ class FindResult(Result): ...@@ -43,7 +43,6 @@ class FindResult(Result):
upper = (skip + limit if skip is not None and limit is not None else upper = (skip + limit if skip is not None and limit is not None else
limit) limit)
# todo sort
if columns is not None: if columns is not None:
self._results = [] self._results = []
for row in rows[skip:upper]: for row in rows[skip:upper]:
...@@ -51,6 +50,9 @@ class FindResult(Result): ...@@ -51,6 +50,9 @@ class FindResult(Result):
else: else:
self._results=rows self._results=rows
if sort:
self._results.sort(key=lambda x: x[sort[0][0]], reverse=sort[0][1] < 0)
def __iter__(self): def __iter__(self):
return iter(self._results) return iter(self._results)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment