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

Add second order_by parameter, as created_at might not be unique #3658

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

philippthun
Copy link
Member

@philippthun philippthun commented Feb 27, 2024

Resources included by decorators are ordered by created_at, which only has a resolution in seconds. This may lead to arbitrary ordering. To ensure a consistent ordering, guid, which has already been utilized by the SequelPaginator for secondary ordering, has been added to the decorators as well.

Additional database statements aim to return the oldest or newest entries from a selection. For those, id has been added as the second order_by parameter.

The specs testing the results of included resources have been improved to ensure a specific ordering by setting a definitive creation date. In some instances, the matcher has been changed from match_array to eq, enabling the tests to verify the order of elements.

  • I have reviewed the contributing guide

  • I have viewed, signed, and submitted the Contributor License Agreement

  • I have made this pull request to the main branch

  • I have run all the unit tests using bundle exec rake

  • I have run CF Acceptance Tests

@philippthun philippthun force-pushed the secondary-order branch 3 times, most recently from e060044 to ca99974 Compare February 29, 2024 12:50
@philippthun philippthun changed the title wip Add second order_by parameter, as created_at might not be unique Feb 29, 2024
@philippthun philippthun marked this pull request as ready for review February 29, 2024 13:45
Resources included by decorators are ordered by 'created_at', which only
has a resolution in seconds. This may lead to arbitrary ordering. To
ensure a consistent ordering, 'guid', which has already been utilized by
the SequelPaginator for secondary ordering, has been added to the
decorators as well.

Additional database statements aim to return the oldest or newest
entries from a selection. For those, 'id' has been added as the second
'order_by' parameter.

The specs testing the results of included resources have been improved
to ensure a specific ordering by setting a definitive creation date. In
some instances, the matcher has been changed from 'match_array' to 'eq',
enabling the tests to verify the order of elements.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant