-
Notifications
You must be signed in to change notification settings - Fork 117
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added null check for Offline LOI #2788
base: master
Are you sure you want to change the base?
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #2788 +/- ##
============================================
- Coverage 61.96% 61.89% -0.08%
Complexity 1166 1166
============================================
Files 265 265
Lines 6223 6235 +12
Branches 877 883 +6
============================================
+ Hits 3856 3859 +3
- Misses 1840 1847 +7
- Partials 527 529 +2
|
Do you mean "when no LOIs are available offline"? |
val loi = | ||
locationOfInterestRepository.getOfflineLoi(mutation.surveyId, mutation.locationOfInterestId) | ||
if (loi == null) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any idea why this might be happening? Was the LOI removed remotely, or perhaps the ID in the local db changed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nvm, I see the LocationOfInterestMutation
references the LOI by UUID, not local DB primary key.
If this happens, shouldn't we show the mutation as "failed" in the sync status screen? To do that, we may need to introduce a new type of error state in SyncStatus
, UNRECOVERABLE_ERROR
for ex. We could also rename FAILED
to PENDING_RETRY
or something clearer and update its current incorrect ktdoc in SyncStatus
.
@sufyanAbbasi to try to take a look at the PR approval in @gino-m 's absence |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry for the delay, I think the code looks good! As @gino-m pointed out, we will definitely want to indicate irreversibly failing mutations, maybe by taking the diff between the map
and mapNotNull
and marking those in the UI as broken.
Fixes #2773
Earlier app crash when any offline LOI is not available.
Added Null check of such LOI access logic
@shobhitagarwal1612 @sufyanAbbasi PTAL?