Fix crash on SubmitDataUseCase - #3885
Open
andreia-ferreira wants to merge 4 commits into
Open
Conversation
andreia-ferreira
requested a deployment
to
e2e-approval
August 14, 2026 14:22 — with
GitHub Actions
Waiting
shobhitagarwal1612
requested changes
Aug 15, 2026
Comment on lines
+144
to
+149
| private suspend fun findDraft(survey: Survey, jobId: String, loiId: String?): DraftSubmission? { | ||
| val draftId = submissionRepository.getDraftSubmissionsId() | ||
| val draft = | ||
| if (draftId.isEmpty()) null else submissionRepository.getDraftSubmission(draftId, survey) | ||
| return draft?.takeIf { it.surveyId == survey.id && it.jobId == jobId && it.loiId == loiId } | ||
| } |
Member
There was a problem hiding this comment.
Should we move this to SubmissionRepository? Or move this logic within getDraftSubmission
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #3882
The crash could be reproduced by doing the following:
adb shell am kill org.groundplatform.androidor having developer options 'no background processes'This was because, when the OS kills the app in the background, the data collection screen is recreated at the task the user was in, but with none of the data collected recovered, which caused the crash mentioning the AddLoi task was missing, and previous answers were also silently missing. The only draft recovery path was when the activity would be recreated and the home screen carried the data in nav arguments.
This PR does the following changes:
DataCollectionInitializernow restores draft data so that the screen recovers correctly regardless of how it was openedTaskSequenceHandlermakes it impossible for a task sequence to resume past a mandatory task that the user hasn't answered to avoid cases where data is silently missingBefore:
Screen_recording_20260814_160426.webm
After:
Screen_recording_20260814_160539.webm
@shobhitagarwal1612 PTAL?