fix(sdk): invalid order of items returned by VotePollsByEndDateDriveQuery #1905
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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:
For repository code-owners and collaborators only