Skip to content

Commit

Permalink
fix: ordering in limit_to_last (#692)
Browse files Browse the repository at this point in the history
When limit_to_last was set, we need to reverse the order. However due to error in comparing the order direction, it was not properly set.

comparing `order.direction == self.ASCENDING` is always `False` because there are two different types.

The correct way is by comparing `order.direction.name == self.ASCENDING`

Fixes #536
  • Loading branch information
Mariatta authored Feb 21, 2023
1 parent bfb97c2 commit cc9dfb3
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion google/cloud/firestore_v1/query.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ def get(
for order in self._orders:
order.direction = _enum_from_direction(
self.DESCENDING
if order.direction == self.ASCENDING
if order.direction.name == self.ASCENDING
else self.ASCENDING
)
self._limit_to_last = False
Expand Down

0 comments on commit cc9dfb3

Please sign in to comment.