Comments (5)
It seems like, for some reason, while the $addLoi
task appears in the task list from Firestore, when we're retrieving the taks lists from the JobEntityAndRelations
in the local DB, that $addLoi
task is no where to be found. Investigating further.
Hypothesis: maybe because the task ID, $addLoi
is shared, the key is not unique so it gets wiped out by another task?
from ground-android.
After debugging some more, by changing the $addLoi
ID to something like $addLoi123
then setting the target LOI task ID to $addLoi123
, the feature began to work again as expected. With breakpoints, I can see that as we iterate over the surveys and store them into the DAO, when the same LOI task ID key is encountered, we store it there.
Given that the taskDao
uses the taskId
as the primary key, it gets overridden by the other tasks when loaded into the DAO. Inspecting the DB revealed the issue:
Proposed fixes:
- Change it from
$addLoi
to$addLoi<JOB ID>
which maintains the unique task ID and we can use a simplestartsWith()
check. Do this transformation on the local DB side and remember to unparse it later at fetch time.- Reconfigure the DB to use both a Primary and Secondary key, the task and job ID, something something?
from ground-android.
Great sleuthing, Sufy! What if we just go back to using the "addLoiTask" boolean? That way clients would be able to count on task IDs being UUIDs. @rfontanarosa does this complicate things much?
from ground-android.
I wanted to report that option 3, having two primary keys, is a completely viable option: I modified the task table, multiple choice table, and option table to use the task ID and job ID as primary keys. I have no crashes and as long as task IDs are unique within a job, the solution actually works REALLY well. Furthermore, consider the scenario in which a sufficiently lazy survey creator wanted to just copy and paste a survey schema. With this solution, they could theoretically JUST change the job ID and the two surveys could coexist on the device. In the status quo scenario, doing the copy operation would be unsafe.
The cost is a table schema update and more complicated key structures which would get in the way of migration.
from ground-android.
Update: We reevaluated this issue, and agreed instead on the solution outlined in google/ground-platform#1530. For now, no changes are needed Android-side. We'll eventually deprecate addLoiTask
boolean, but not in this version, so closing this for now.
from ground-android.
Related Issues (20)
- Consecutive geometry tasks fails to render (com.google.maps.api.android.lib6.impl.as cannot be cast to android.view.ViewGroup)
- Use protos when creating submissions HOT 3
- [Data collection] Prompt data collectors to agree to data sharing terms HOT 1
- Use protos when reading LOIs
- Use protos when creating LOIs HOT 1
- Use protos when reading survey list
- Use protos when reading survey
- [Test coverage] Add unit test for adhoc data submission flow
- [Code health] Packing Structure of Unit Test HOT 3
- [Code health] Replace SignInState.State enum with a sealed data class
- [Code health] CaptureLocationTaskMapViewModel UnitTest
- [Test Coverage] Add Unit Test for Point
- [Analytics integration] Description
- [Multiple choice tasks] "Other" text field obscured by keyboard
- [Test Coverage] Add Unit Test of LineString
- [Test Coverage] Add Unit Test for CaptureLocationTaskViewModel HOT 6
- [Code health] Android Resources in ViewModel is not good practice HOT 1
- [Code health] Automate License Addition to new file HOT 1
- [Code health] Add Unit Test for Polygon and Multipolygon
- [Code health] Add unit test for MapStateRepository
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ground-android.