Skip to content

Comments

fix: ordering in limit_to_last#692

Merged
engelke merged 1 commit intomainfrom
fix-limit-to-last-order
Feb 21, 2023
Merged

fix: ordering in limit_to_last#692
engelke merged 1 commit intomainfrom
fix-limit-to-last-order

Conversation

@Mariatta
Copy link
Contributor

@Mariatta Mariatta commented Feb 18, 2023

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

Thank you for opening a Pull Request! Before submitting your PR, there are a few things you can do to make sure it goes smoothly:

  • Make sure to open an issue as a bug/issue before writing your code! That way we can discuss the change, evaluate designs, and agree on the general idea
  • Ensure the tests and linter pass
  • Code coverage does not decrease (if any source code was changed)
  • Appropriate docs were updated (if necessary)

Fixes #<issue_number_goes_here> 🦕

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
@Mariatta Mariatta requested review from a team as code owners February 18, 2023 01:12
@product-auto-label product-auto-label bot added size: xs Pull request size is extra small. api: firestore Issues related to the googleapis/python-firestore API. labels Feb 18, 2023
@engelke engelke merged commit cc9dfb3 into main Feb 21, 2023
@engelke engelke deleted the fix-limit-to-last-order branch February 21, 2023 21:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

api: firestore Issues related to the googleapis/python-firestore API. size: xs Pull request size is extra small.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Firestore limit_to_last(n) returns the first n elements in a reverse order instead of returning the last n elements

3 participants