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

Possible typo in odata offset handling #1115

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

Conversation

alxndrsn
Copy link
Contributor

fiindIndex() looks like it should be findIndex()

fiindIndex() looks like it should be findIndex()
@alxndrsn alxndrsn changed the title formats/odata: fix offset handling Possible typo in odata offset handling Mar 22, 2024
@matthew-white
Copy link
Member

Good catch, @alxndrsn! This does look like an issue to me. I confirmed that it can result in a user-facing error: getodk/central#622. In addition to fixing the typo, I think it'd be a good idea to write a test. There must not be a test that's hitting that function right now.

It could be that this usage pattern isn't common. I'd guess that a user is more likely to use $skiptoken to page through an entire repeat group (which hits rowStreamToOData()) rather than just the repeat group instances of an individual submission (singleRowToOData()). That said, I do think it'd be worth fixing this issue.

This is only sort of related, but what happens if the user specifies an invalid $skiptoken? It seems possible to me that findIndex() would return -1 if a submission edit causes the repeatId to no longer exist (if the edit removes the relevant repeat group instance). From a glance, I think the response would be successful and return data, but I don't think it should. I'd be happy to take a closer look at that once the main issue here is fixed.

@alxndrsn, are you interested in writing a test for this issue? We could also pass that off to me or @sadiqkhoja. I'm glad you made a note of this line!

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.

None yet

2 participants