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

Statuses endpoint failed on submission made via ODK #1478

Closed
NSUWAL123 opened this issue Apr 25, 2024 · 8 comments
Closed

Statuses endpoint failed on submission made via ODK #1478

NSUWAL123 opened this issue Apr 25, 2024 · 8 comments
Assignees
Labels
backend bug Something isn't working Priority: Must have QA ready Any issues that is fixed

Comments

@NSUWAL123
Copy link
Collaborator

Describe the bug
/Statuses endpoint throws 500 error after building submission made via ODK.

To Reproduce
Steps to reproduce the behavior:

  1. Create a project
  2. Go to project-details page (Here the /statuses endpoint is hit and the response status is 200)
  3. Go to ODK and make a submission
  4. Go to or Refresh the project-details page and see 500 error on /statuses endpoint

Expected behavior
/statuses API should not throw a 500 error even if a submission is made.

Screenshots
If applicable, add screenshots to help explain your problem.
Before submission was made:
image_720

After submission was made:
image

Smartphone (please complete the following information):

  • Device: [Laptop]
  • OS: [Ubuntu]
  • Browser [Google Chrome]
  • Version []

Additional context

@Sujanadh
Copy link
Collaborator

endpoint works fine, but when submission is made how odk collect sends status to the odk central? it is passing quoted task status . For eg: 'status' : ' "2" '.

@Sujanadh
Copy link
Collaborator

@spwoodcock

@spwoodcock
Copy link
Member

Interesting!

The integer value needs to be quoted, as Entity fields can only be string type.

But it looks like double quoting that needs to be fixed.

Not sure why that would cause a 500 though!

@Sujanadh
Copy link
Collaborator

Got a validation error since the quoted index won't match the enum.

@spwoodcock
Copy link
Member

spwoodcock commented Apr 26, 2024

Fantastic - great debugging!

Do you think this could be caused by the XLSForm?

The status field defaults to "2" and the calculation logic is if(${digitisation_correct}='no', "6", "2")

My assumption is that there is already logic in ODK Collect to wrap the values in quotes before sending to Central.

@spwoodcock spwoodcock added the QA ready Any issues that is fixed label Apr 29, 2024
@NSUWAL123
Copy link
Collaborator Author

@spwoodcock, currently the /statuses api would return thousands of statuses of features of the entire project.
Is this approach good? As we have to filter that thousands of buildings status to colorize each feature.

Is returning the statuses of the features bound to that task would be a good approach? like when a user clicks a task then /statuses endpoint is called with a filter of taskId

@spwoodcock
Copy link
Member

It's not so easy to do that unfortunately, as the odata endpoints for ODK Central a bit limited in their filtering capability.
Perhaps this may change in the future and we can consider updating.
But for now we are kind of stuck with it 😅

Are you seeing performance issues with the approach?
The endpoint takes about 0.3s to return for 600 features when testing, the payload is about 60kb.
So imagining this scales linearly, that would be 3s for 6000 features, and 600kb.
If the user is mapping 6000 features in one campaign, it's probably better they subdivide further into districts!

@NSUWAL123
Copy link
Collaborator Author

It wastn't a performance issue. It was the issue with debug console😆. I had consoled inside the getFeatureStyle where the website was too much laggy and unresponsive during console. But consoling after debug commenting console woked perfectly fine.
But as you said in future we also need to consider project with too many features as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backend bug Something isn't working Priority: Must have QA ready Any issues that is fixed
Projects
Development

No branches or pull requests

4 participants