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

Update hotspotsController.js to return ordered list of hotspots #4

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

Conversation

jmarcelino
Copy link

Order hotspots by id when returning all hotspots

This is particularly important for paginating otherwise the pagination will not be consistent across page requests, ie requesting the same page number will return different, random, hotspots

Order hotspots by id for paginating
@jmarcelino jmarcelino changed the title Update hotspotsController.js Update hotspotsController.js to return ordered list of hotspots Apr 12, 2022
Copy link
Contributor

@tyler-whitman tyler-whitman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me, did you get a chance to test this out? What order were they in before?

@jmarcelino
Copy link
Author

jmarcelino commented Apr 13, 2022

Thanks! I did test it out in our instance.

Without the explicit order findAll seems to return data in random order and thus the pagination result would also be random, for example if you request page 1 multiple times you get a different set of entries each time.

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.

2 participants