Repository navigation
Prevent duplicate LOI and submission when tapping Done repeatedly - #3989
Conversation
There was a problem hiding this comment.
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 Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #3989 +/- ##
============================================
- Coverage 70.03% 70.03% -0.01%
- Complexity 2106 2108 +2
============================================
Files 441 441
Lines 11869 11877 +8
Branches 1545 1545
============================================
+ Hits 8313 8318 +5
- Misses 2780 2783 +3
Partials 776 776
🚀 New features to boost your workflow:
|
…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
…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
closes #3974