posm / OpenMapKitAndroid

http://openmapkit.org
BSD 3-Clause "New" or "Revised" License
128 stars 38 forks source link

Multiple value select: double values written sometimes #121

Closed PaulUithol closed 8 years ago

PaulUithol commented 8 years ago

I haven't been able to figure out exactly what triggers this yet; but sometimes, the complete value string seems to be written out twice (both when selecting just a single option, or selecting multiple).

Entering OMK again (either to retag a node, or as part of another form) does seem to be a prerequisite though. The doubled up string is also written out into the .osm file.

screenshot_2016-01-09-19-36-07 screenshot_2016-01-09-19-37-12

hallahan commented 8 years ago

Could you send me the specifc XLS form and OSM data used? I think I understand the workflow you are describing. This only happens when revisiting a node that you previously tagged?

I'm thinking I could filter out duplicate tokens from the given string, but I'd like to know the underlying cause. This issue should piggy-back with #120 with a fix that solves both problems.

PaulUithol commented 8 years ago

This seems to be quite a serious one; seeing it on all the phones, with different data (Kampala or Mbale) and different form versions. I've cut it down to using just one form, no osm data, one mbtiles for background.

Form: https://drive.google.com/open?id=0Bx3_hrMYdNwLUV9RZXF6U0pKb1U Mbtiles: https://drive.google.com/open?id=0Bx3_hrMYdNwLN0taTUJUbXZWdTg

One sequence that certainly seems to trigger it:

  1. Add a POI (mobile money agent form). Set amentiy=mobile_money_agent and select a couple of networks (for example, network=Airtel Money;MTN Mobile Money). Then save, go to end, exit & finalize form.
  2. Add another POI (mobile money agent form). Set amentiy=mobile_money_agent and select a couple of networks. Then save, go to end, exit & finalize form.
  3. Go to "Edit saved form", go to the first one, "Redo OSM tagging", and for both points look at the amenity and network values. Usually, at least one of them is doubled up now.
PaulUithol commented 8 years ago

It keeps adding values as well; I've seen them with yes;yes;yes for a yes/no question.

hallahan commented 8 years ago

Troubleshooting today.

hallahan commented 8 years ago

I think this problem is due to bug #115. It looks like this got introduced when we started putting timestamps on the file name. This made a unique file name on each write. I'm wondering if ODK collect rewrites media attachments (OSM files) when finalizing a form...

screenshot 2016-01-10 13 05 27
PaulUithol commented 8 years ago

Not quite sure if that's connected? Just had one go from mobile_money_agent to mobile_money_agent; mobile_money_agent; mobile_money_agent; mobile_money_agent; mobile_money_agent in one save (amenity), but network is still okay. So it seems to be an issue per key, not the whole file? Only see one .osm file as well. On Jan 11, 2016 12:07 AM, "Nicholas Hallahan" notifications@github.com wrote:

I think this problem is due to bug #115 https://github.com/AmericanRedCross/OpenMapKitAndroid/issues/115. It looks like this got introduced when we started putting timestamps on the file name. This made a unique file name on each write. I'm wondering if ODK collect rewrites media attachments (OSM files) when finalizing a form...

[image: screenshot 2016-01-10 13 05 27] https://cloud.githubusercontent.com/assets/556367/12224001/0f17f95a-b79b-11e5-8beb-c9420a49a1ef.png

— Reply to this email directly or view it on GitHub https://github.com/AmericanRedCross/OpenMapKitAndroid/issues/121#issuecomment-170393951 .

hallahan commented 8 years ago

This bug is really inconsistent. I was able to reproduce it a few times, doing your workflow, and not it doesn't seem to happen anymore... I think you are right, that it's a per key issue.

hallahan commented 8 years ago

Regardless, I think putting all of the tag values that I'm gathering into a HashSet will guarantee that the set has unique values.

http://developer.android.com/reference/java/util/HashSet.html

Then, I'll iterate through that hash set, putting in ; with that.