ground-android icon indicating copy to clipboard operation
ground-android copied to clipboard

App in invalid state when current survey is deleted on remote

Open gino-m opened this issue 1 year ago • 7 comments

When we detect the deletion event, we shoud:

  1. Deactive the current survey
  2. Show the user a message
  3. Redirect to the survey list

@rawbzz PTAL?

gino-m avatar Aug 23 '24 14:08 gino-m

so this is when a user is already in the survey collecting data, but the survey got deleted right? in that case, I think they should get a message that pops up, and it redirects them to the survey list

Screenshot 2024-08-23 at 11 01 28 AM

rawbzz avatar Aug 23 '24 15:08 rawbzz

LGTM! @amegantz @rawbzz Let's just update the text to make it clear it wasn't the user who accidentally deleted the survey, but rather the survey organizers. Thanks!

gino-m avatar Aug 23 '24 15:08 gino-m

image Survey deleted This survey has been deleted by the survey organizers. Select another survey. [Go to surveys]

amegantz avatar Aug 27 '24 22:08 amegantz

@amegantz LGTM!

gino-m avatar Aug 28 '24 01:08 gino-m

@amegantz @rawbzz @gino-m If the user has collected the data and then the survey got deleted, then how are we telling user that all these collected data are going to be deleted now?

anandwana001 avatar Aug 28 '24 13:08 anandwana001

The current model is "send it and forget it" in the sense that users cannot access the data once they've shared it with organizers, so in general they have no visibility into the current remote state of data. The product WG may decide to change this is in the future, but as it stands now they wouldn't get notified.

gino-m avatar Aug 28 '24 13:08 gino-m

After deleting the remote survey, the following sequence of events happen on the app:

  • App receives a broadcast to sync survey from remote
  • App initiates a request to sync survey
  • The request attempts to fetch the survey for the given id from remote datastore.
  • An exception is thrown: com.google.firebase.firestore.FirebaseFirestoreException: PERMISSION_DENIED: Missing or insufficient permissions.

Maybe we first need to update the firebase function to return appropriate error code (NOT_FOUND). Another option is to send some metadata with the broadcast message specifying that the survey has been deleted instead of attempting to re-sync.

shobhitagarwal1612 avatar Oct 20 '24 05:10 shobhitagarwal1612

Maybe we first need to update the firebase function to return appropriate error code (NOT_FOUND). Another option is to send some metadata with the broadcast message specifying that the survey has been deleted instead of attempting to re-sync.

Perhaps it's the Firebase rule that need to be updated so that we receive NOT_FOUND when the document doesn't exist. What value does the rule receive for resource when the document is not found?

gino-m avatar Nov 06 '24 18:11 gino-m

I've been low on bandwidth for the past few weeks. Will try to spend some time on it early next week.

shobhitagarwal1612 avatar Nov 07 '24 05:11 shobhitagarwal1612

@shobhitagarwal1612 Let's postpone for now and demote to P2.

gino-m avatar Nov 20 '24 15:11 gino-m