From 2c0d7e0a96926818c382daf138405d0e35a534ab Mon Sep 17 00:00:00 2001 From: Mariatta Wijaya Date: Fri, 17 Feb 2023 17:12:15 -0800 Subject: [PATCH] fix: ordering in limit_to_last 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 --- google/cloud/firestore_v1/query.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/google/cloud/firestore_v1/query.py b/google/cloud/firestore_v1/query.py index 700493725f..7cabfcc5f9 100644 --- a/google/cloud/firestore_v1/query.py +++ b/google/cloud/firestore_v1/query.py @@ -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