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

Task completion endpoint showing false submission count #1483

Open
NSUWAL123 opened this issue Apr 26, 2024 · 3 comments
Open

Task completion endpoint showing false submission count #1483

NSUWAL123 opened this issue Apr 26, 2024 · 3 comments
Assignees
Labels
backend bug Something isn't working

Comments

@NSUWAL123
Copy link
Collaborator

Describe the bug
When submission made to one task via ODK collect, all other tasks submissions is also incremented.
For example:
Assume a project has 10 tasks. When a submission is made to one task via ODK, the submission count of that task should only increment but submissions of other tasks are also incremented .

To Reproduce

  1. Create a project
  2. Go to ODK collect and make a submission to any one task
  3. Go to the project submissions page or refresh the page and open the network tab
  4. See the response of the /task-completion API and see incremented submission counts of all the tasks

Expected behavior
The submission count of that specific task should only increase when submission is made.

Screenshots
Here I made 2 submissions to task 5 only but the entire task submission count seems to be updated.
image

Laptop (please complete the following information):

  • Device: [Laptop]
  • OS: []
  • Browser [Chrome]
  • Version [e.g. 22]

Additional context
Add any other context about the problem here.

@NSUWAL123 NSUWAL123 added bug Something isn't working backend labels Apr 26, 2024
@spwoodcock
Copy link
Member

Good catch, thanks!

Previously each task was mapped to an XForm.
Now each task uses the same XForm, hence the issue here.

The submissions stuff needs a big overhaul now we are using Entities. The submission count can probably be determined without needing a separate endpoint now.

We could use the response from /project/id/statuses to determine how many features have status=2. Those Entities have been mapped and count as a submission.

@spwoodcock
Copy link
Member

As the response also includes when the Entities were last updated, those values could be filtered and the 'last_submission` value also determined.

image

Do you think you could handle this entirely on the frontend @NSUWAL123 ?

  • Remove the call to task-completion.
  • Get the statuses and last submission time from the /projects/{project_id}/entities/statuses endpoint by filtering.

@NSUWAL123
Copy link
Collaborator Author

As the response also includes when the Entities were last updated, those values could be filtered and the 'last_submission` value also determined.

image

Do you think you could handle this entirely on the frontend @NSUWAL123 ?

  • Remove the call to task-completion.
  • Get the statuses and last submission time from the /projects/{project_id}/entities/statuses endpoint by filtering.

@spwoodcock could you elaborate

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
Projects
None yet
Development

No branches or pull requests

3 participants