google / ground-platform

Ground hosted components: Web console, Cloud Functions, db config
http://groundplatform.org
Apache License 2.0
206 stars 88 forks source link

[Download CSV] "Other" multiple choice values appear as blank #2099

Open gino-m opened 5 days ago

gino-m commented 5 days ago

These values appear blank in the exported data when no user text is specified.

Expected: "Other" or "Other: " (without <>).

@rfontanarosa

rfontanarosa commented 4 days ago

this is the db when other text is specified:

Image

this is the db when other text is left blank:

Image

proto doesn't convert otherText:

MultipleChoiceResponses {selectedOptionIds: Array(0), otherText: 'ttt'} MultipleChoiceResponses {selectedOptionIds: Array(0)}

gino-m commented 4 days ago

We should fix this upstream in the Android app (https://github.com/google/ground-android/issues/2846). Once fixed, can we retroactively patch the db by looking for cases where field 7 is specified but empty? This won't help in multiple select (checkbox) cases where >1 value was selected, but we can at least patch the cases where only "other" was selected with no text.

rfontanarosa commented 4 days ago

in any case, I think that a change should be done. Let's leave "Other: X" if the value exists, and just "Other" if the value is empty.

in submission view and export csv.

@gino-m wdyt?

gino-m commented 4 days ago

in any case, I think that a change should be done. Let's leave "Other: X" if the value exists, and just "Other" if the value is empty.

in submission view and export csv.

Yep, that was my suggestion. Does the deserializer give you an empty MultipleChoiceSelection object when "Other" is selected but no text specified? Or will you need to add a workaround the proto deserializer?

rfontanarosa commented 3 days ago

it gives back an empty object. in theory we should add a workaround in the deserializer but I think it is better to fix it android side. at the moment we have:

{
    8:
    [
        {
            2: "taskId",
            7: {}
        }
    ]
}

we should have

{
    8:
    [
        {
            2: "taskId",
            7: {2: ""}
        }
    ]
}
gino-m commented 3 days ago

@rfontanarosa Yes, I was suggesting fixing it on the Android side, but trying to see where we could add a workaround web and export side in the meantime. If the TypeScript implementation returns an empty object only when there's an "Other" with no text, can we add a patch to interpret that as such?