Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(sdk): invalid order of items returned by VotePollsByEndDateDriveQuery #1905

Conversation

lklimek
Copy link
Contributor

@lklimek lklimek commented Jun 25, 2024

Issue being fixed or feature implemented

VotePollsByEndDateDriveQuery supports order_ascending field for the requests.
Unfortunately, internally we use BTreeMap that always orders items in ascending order.

There is a rev() method to reverse iteration, but it's not intuitive - as user requested reversed objects, standard iter() should return them in reverse order.

What was done?

Implemented OrderedBTreeMap that allows iterating over items in reverse order and used it in VotePollsGroupedByTimestamp.

Note: this only fixes Sdk-side of the issue. Drive still returns items in invalid order.

How Has This Been Tested?

Test fetch::contested_resource_polls_by_ts::vote_polls_by_ts_order is green.

Breaking Changes

None

Checklist:

  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have added or updated relevant unit/integration/functional/e2e tests
  • I have added "!" to the title and described breaking changes in the corresponding section if my code contains any
  • I have made corresponding changes to the documentation if needed

For repository code-owners and collaborators only

  • I have assigned this pull request to a milestone

@lklimek lklimek changed the title fix(sdk): correct order of results returned by sdk fix(sdk): invalid order of items returned by VotePollsByEndDateDriveQuery Jun 25, 2024
@lklimek lklimek marked this pull request as ready for review June 25, 2024 12:48
@lklimek
Copy link
Contributor Author

lklimek commented Jun 28, 2024

Refactored to use Vec<> instead of BTreeMap, included in #1906

@lklimek lklimek closed this Jun 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant