Skip to content

Commit 6f9127e

Browse files
author
Alejandro Casanovas
committed
Buggy behaviour in Query.get_order
1 parent fbab59c commit 6f9127e

File tree

1 file changed

+3
-21
lines changed

1 file changed

+3
-21
lines changed

O365/utils/utils.py

Lines changed: 3 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -732,27 +732,9 @@ def get_order(self):
732732
# in the order_by first
733733
if not self.has_order:
734734
return None
735-
filter_order_clauses = OrderedDict([(filter_attr[0], None)
736-
for filter_attr in self._filters
737-
if isinstance(filter_attr, list)])
738-
739-
# any order_by attribute that appears in the filters is ignored
740-
order_by_dict = self._order_by.copy()
741-
for filter_oc in filter_order_clauses.keys():
742-
direction = order_by_dict.pop(filter_oc, None)
743-
filter_order_clauses[filter_oc] = direction
744-
745-
filter_order_clauses.update(
746-
order_by_dict) # append any remaining order_by clause
747-
748-
if filter_order_clauses:
749-
return ','.join(['{} {}'.format(attribute,
750-
direction if direction else '')
751-
.strip()
752-
for attribute, direction in
753-
filter_order_clauses.items()])
754-
else:
755-
return None
735+
736+
return ','.join(['{} {}'.format(attribute, direction or '').strip()
737+
for attribute, direction in self._order_by.items()])
756738

757739
def get_selects(self):
758740
""" Returns the result select clause

0 commit comments

Comments
 (0)