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

REST endpoint for …/entities does not use a stable order #582

Closed
matthew-white opened this issue Jan 11, 2024 · 0 comments · Fixed by getodk/central-backend#1097
Closed
Assignees
Labels
backend Requires a change to the API server bug entities Multiple Encounter workflows

Comments

@matthew-white
Copy link
Member

Problem description

The OData feed for entities returns entities in a stable order, with the most recently created entity coming first:

https://github.com/getodk/central-backend/blob/983ec81e69793fdb589ffdc346a16ef977489be4/lib/model/query/entities.js#L452

However, the REST endpoint for …/entities returns entities in a different order, with the entity that was created or updated least recently coming first (essentially). Note that because the order is sensitive to updates, it isn't stable.

https://github.com/getodk/central-backend/blob/983ec81e69793fdb589ffdc346a16ef977489be4/lib/model/query/entities.js#L372

Steps to reproduce the problem

  1. Create an entity with a label of "foo". Create a second entity with a label of "bar".
  2. Observe that initially, …/entities lists foo before bar.
  3. Update foo.
  4. Observe that now, …/entities lists bar before foo.

Expected behavior

I think that the OData feed for submissions and the REST endpoint for …/submissions return submissions in the same order. Maybe entity endpoints should likewise be consistent?

@matthew-white matthew-white added bug backend Requires a change to the API server entities Multiple Encounter workflows labels Jan 11, 2024
@github-project-automation github-project-automation bot moved this to 🕒 backlog in ODK Central Jan 11, 2024
@ktuite ktuite self-assigned this Feb 13, 2024
@ktuite ktuite moved this from 🕒 backlog to ✏️ in progress in ODK Central Mar 5, 2024
@github-project-automation github-project-automation bot moved this from ✏️ in progress to ✅ done in ODK Central Mar 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backend Requires a change to the API server bug entities Multiple Encounter workflows
Projects
Status: ✅ done
Development

Successfully merging a pull request may close this issue.

2 participants