Skip to content

Commit cc9dfb3

Browse files
authored
fix: ordering in limit_to_last (#692)
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
1 parent bfb97c2 commit cc9dfb3

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

google/cloud/firestore_v1/query.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ def get(
160160
for order in self._orders:
161161
order.direction = _enum_from_direction(
162162
self.DESCENDING
163-
if order.direction == self.ASCENDING
163+
if order.direction.name == self.ASCENDING
164164
else self.ASCENDING
165165
)
166166
self._limit_to_last = False

0 commit comments

Comments
 (0)