Skip to content

Prevent duplicate LOI and submission when tapping Done repeatedly - #3989

Open
rfontanarosa wants to merge 5 commits into
masterfrom
rfontanarosa/3974/data-collection-tapping-done-more-than-once-on-the-last-task-creates-duplicate-loi-submission-pairs
Open

rfontanarosa wants to merge 5 commits into
masterfrom
rfontanarosa/3974/data-collection-tapping-done-more-than-once-on-the-last-task-creates-duplicate-loi-submission-pairs

Conversation

@rfontanarosa

Copy link
Copy Markdown
Collaborator

closes #3974

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a mechanism to prevent duplicate submissions in DataCollectionViewModel by tracking the submission state with an AtomicBoolean (isSubmitting). It refactors the submission logic into a submit function and adds a corresponding unit test to verify that multiple taps on the last task only trigger a single submission. The review feedback highlights a potential data loss issue where clearDraft() is called before saveChanges(); if saving fails, the draft is already deleted. It is recommended to move clearDraft() to execute only after saveChanges() completes successfully.

@codecov

codecov Bot commented Oct 23, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 82.35294% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 70.03%. Comparing base (4240c1b) to head (b5a94ad).

Files with missing lines Patch % Lines
...droid/ui/datacollection/DataCollectionViewModel.kt 82.35% 3 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff            @@
##             master    #3989   +/-   ##
=========================================
  Coverage     70.03%   70.03%           
- Complexity     2105     2108    +3     
=========================================
  Files           441      441           
  Lines         11869    11877    +8     
  Branches       1545     1545           
=========================================
+ Hits           8312     8318    +6     
- Misses         2781     2783    +2     
  Partials        776      776           
Files with missing lines Coverage Δ
...droid/ui/datacollection/DataCollectionViewModel.kt 80.32% <82.35%> (-0.61%) ⬇️

... and 1 file with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

…done-more-than-once-on-the-last-task-creates-duplicate-loi-submission-pairs
…done-more-than-once-on-the-last-task-creates-duplicate-loi-submission-pairs
…done-more-than-once-on-the-last-task-creates-duplicate-loi-submission-pairs
…done-more-than-once-on-the-last-task-creates-duplicate-loi-submission-pairs

This branch is waiting to be deployed

1 waiting deployment
e2e-approval — b5a94ad3 Waiting Oct 31, 2026 by rfontanarosa via instrumentation-tests / request-approval #1363
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Data collection: tapping "Done" more than once on the last task creates duplicate LOI + submission pairs

1 participant