Skip to content

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

Open
jmarcelino wants to merge 1 commit into
helium:mainfrom
jmarcelino:fix-ordering
Open

Update hotspotsController.js to return ordered list of hotspots#4
jmarcelino wants to merge 1 commit into
helium:mainfrom
jmarcelino:fix-ordering

Conversation

@jmarcelino

Copy link
Copy Markdown

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

@tyler-whitman tyler-whitman left a comment

Copy link
Copy Markdown
Contributor

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

jmarcelino commented Apr 13, 2022

Copy link
Copy Markdown
Author

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