google / ground-android

Ground mobile data collection app for Android
http://groundplatform.org
Apache License 2.0
243 stars 114 forks source link

[Offline sync status] Duplicate entries shown in status screen #2389

Closed gino-m closed 4 weeks ago

gino-m commented 5 months ago

Describe the bug When adding a new LOI, two entries appear, one of which never completes.

To Reproduce Steps to reproduce the behavior:

  1. Add a new LOI and collect data
  2. Open sync status screen

Expected behavior There is only one entry shown for the LOI, submission, and photo.

Actual behavior Two entries are shown, one of which never finishes.

Screenshots

Screenshot_20240317-105913.png

Screenshot_20240317-105937.png

Screenshot_20240317-105952.png

@scolsen PTAL? @jcqli for tracking.

gino-m commented 3 months ago

@shobhitagarwal1612 Could you PTAL this one, related to sync status screen?

shobhitagarwal1612 commented 2 months ago

During my investigation, I discovered that we only mark the status of SubmissionMutations as "COMPLETE" in MediaUploadWorker, which disregards LoiMutations.

There are two potential solutions:

  1. Assuming LOI Mutations will never contain media, we can directly set their status as done, eliminating the "Pending for media upload" state.
  2. Assuming LOI Mutations might include media in the future, we must update the media upload worker to handle them.

Recommendation: Since LoiMutations also consist of tasks, it's possible to incorporate a media upload task in the LOI creation flow. However, option 2 requires more effort than option 1. Hence, if LOIs will never have media tasks, option 1 is sensible. Otherwise, option 2 should be chosen.

Additionally, we need to introduce another text field in the displayed card to distinguish between "Submission" and "LOI" mutations.

@gino-m and @sufyanAbbasi, please share your thoughts on these options.

gino-m commented 2 months ago

Additionally, we need to introduce another text field in the displayed card to distinguish between "Submission" and "LOI" mutations.

Thank you @shobhitagarwal1612 for the thorough investigation. The user doesn't think of the data collection flow as "LOI, Submission, and Media" mutations, but rather as a single flow. In that case, would be possible to group all three types by some ID (a new data collection flow ID?) so that they can be correctly grouped as a single action? I believe that would make several of the questions you mentioned moot. Lmkwyt.

shobhitagarwal1612 commented 2 months ago

But from implementation point of view, do we ever expect LoiMutations to contain media related tasks?

gino-m commented 2 months ago

But from implementation point of view, do we ever expect LoiMutations to contain media related tasks?

No. :)

shobhitagarwal1612 commented 2 months ago

The user doesn't think of the data collection flow as "LOI, Submission, and Media" mutations, but rather as a single flow. In that case, would be possible to group all three types by some ID (a new data collection flow ID?) so that they can be correctly grouped as a single action?

One LOI (predefined or adhoc) can have multiple mutations. So, it is not feasible to group mutations by LOI. Possible options:

  1. Keep the LOI mutation but add a different label to it
  2. Hide the LOI mutation once the sync is complete
  3. Don't show the LOI mutation at all in sync status screen
  4. Create a separate screen or section for LOI mutations
gino-m commented 2 months ago

If it's not much more work, my preference would be to link them all by some common, new "collection" or "add/edit" ID that is assigned to each time to data collection flow is opened. That way if we add "edit" in the future, changes can be grouped by user action (i.e. the user opened "collect" or "modify data", went through the flow, and hit submit/save). Is that possible?