Skip to content

Tell clients to delete entities when their submissions have not been approved #685

@matthew-white

Description

@matthew-white

There's a question of how offline entities should work for an entity list that requires submission approval when creating entities from submissions. The OpenRosa spec proposal for offline entities mentions a use case for the integrityUrl (#668) that involves submission approval:

An Entity List is configured to only create Entities on submission approval. Collect will create Entities offline in that case. If an Entity-creating submission is rejected, the Entity should be deleted from Collect

In that case, Central would return <deleted>true</deleted> for an entity that would have been created from a rejected submission. Actually, Central could return <deleted>true</deleted> for any new entity that it's seen in a submission (any new entity that it's even partially processed). Whether or not the submission is approved or rejected, the entity no longer needs to remain on the device as long as we know it's on the server and awaiting action there. As @lognaturel writes on Slack:

There’s a related and possibly even more complicated case which is when the submission has been made but not yet approved or rejected. Ideally that would also mean the Entity gets deleted locally.

Another idea we've discussed is to use the OpenRosa manifest to indicate to Collect that the entity list requires submission approval. The idea is that if an entity list is identified as requiring submission approval, Collect shouldn't create offline entities for the entity list. Forms could still share the entity list (reducing storage needs), but forms wouldn't add offline entities to the list.

If we go that route, one edge case to consider is if the submission approval setting is toggled after Collect downloads the OpenRosa manifest. In that case, Collect could end up creating offline entities for an entity list that didn't initially require submission approval, but was later set up to. As above, there would maybe be cases where Collect would need to be told to delete some of the offline entities.

Metadata

Metadata

Assignees

Labels

backendRequires a change to the API server

Type

No type

Projects

Status

✅ done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions