Skip to content

Rework answering select one from map questions#6973

Merged
grzesiek2010 merged 6 commits intogetodk:masterfrom
seadowg:widget-answer
Dec 9, 2025
Merged

Rework answering select one from map questions#6973
grzesiek2010 merged 6 commits intogetodk:masterfrom
seadowg:widget-answer

Conversation

@seadowg
Copy link
Member

@seadowg seadowg commented Nov 24, 2025

Work towards #6969

Why is this the best possible solution? Were any other approaches considered?

This reworks/simplifies how the answer from a "select one from map" question is saved. The idea here was to make it as simple as possible to use the same approach in the geoshape/geotrace questions with incremental=true.

How does this change affect users? Describe intentional changes to behavior and behavior that could have accidentally been affected by code changes. In other words, what are the regression risks?

There shouldn't be any observable change in behaviour. The change is isolated to answering select one from map questions so that's the only thing that needs to be tested. Things that come to mind that there could be problematic interactions with are audit logs, appearances and savepoints. There were no changes to any of the map code so no need to test with different map settings.

There's an issue which we'll need to come back and fix. For the moment, I think merging this is higher priority as it unblocks further incremental=true work.

Before submitting this PR, please make sure you have:

  • added or modified tests for any new or changed behavior
  • run ./gradlew connectedAndroidTest (or ./gradlew testLab) and confirmed all checks still pass
  • added a comment above any new strings describing it for translators
  • added any new strings with date formatting to DateFormatsTest
  • verified that any code or assets from external sources are properly credited in comments and/or in the about file.
  • verified that any new UI elements use theme colors. UI Components Style guidelines

@seadowg
Copy link
Member Author

seadowg commented Nov 26, 2025

@getodk/testers marking this as "needs testing" early to gain confidence that this doesn't break anything before moving on!

@dbemke
Copy link

dbemke commented Nov 27, 2025

I've noticed something new (I haven't seen it on the master version or the store version). After moving from the map back to the question answers "appear" - I can see the moment when they appear. Answers used to be displayed the moment I was moved back to the question (from the map). Has this thing changed?
To notice this, slow down the video.

XRecorder_27112025_134431.mp4

@seadowg
Copy link
Member Author

seadowg commented Nov 27, 2025

Answers used to be displayed the moment I was moved back to the question (from the map). Has this thing changed?

Yeah I'd expect the answer to take milliseconds longer to show with the new approach as we re-render the question rather than just updating it. This looks fine in the video, maybe it would be good to test on the slowest device you have and with field lists?

@dbemke
Copy link

dbemke commented Nov 28, 2025

maybe it would be good to test on the slowest device you have and with field lists?

You're right. I can see it on a field list, too. After re-rendering the question the field list is scrolled to the top.
The issue doesn't occur on the store or master version.

XRecorder_28112025_074228.mp4

@seadowg
Copy link
Member Author

seadowg commented Nov 28, 2025

You're right. I can see it on a field list, too. After re-rendering the question the field list is scrolled to the top.
The issue doesn't occur on the store or master version.

Am I right in thinking the only problem here is the jump back to the top in the field list? Or does the delay feel long enough to be a regression?

@dbemke
Copy link

dbemke commented Nov 28, 2025

Am I right in thinking the only problem here is the jump back to the top in the field list? Or does the delay feel long enough to be a regression?

That it reloads questions so I guess that's why the field-list is scrolled to the top. Scrolling the field list is a regression.
I'm still testing if the delay can mess up some calculations based on the select one from map etc and the delay on other devices.

@dbemke
Copy link

dbemke commented Nov 28, 2025

does the delay feel long enough to be a regression?

On the slowest device I could find the delay looks like a feature - if I change the answer I can see values changing so it feels ok to me.

@seadowg
Copy link
Member Author

seadowg commented Nov 28, 2025

@dbemke thanks! Ok so it looks like the key thing to fix here before we can move ahead is the field list jumping back problem.

@dbemke
Copy link

dbemke commented Nov 28, 2025

Ok so it looks like the key thing to fix here before we can move ahead is the field list jumping back problem

Yes. We finished testing.

@seadowg seadowg force-pushed the widget-answer branch 2 times, most recently from 11298e1 to 442db6e Compare December 1, 2025 18:54
@seadowg
Copy link
Member Author

seadowg commented Dec 1, 2025

I can see it on a field list, too. After re-rendering the question the field list is scrolled to the top.

@dbemke this should be fixed now. It also should do it's best to scroll back to the right place if the field list questions change after answering the select one from map question (making others not relevant for example).

There's a slight flash when returning from the map to the form in field lists, but I think we can live with that for now. If that's the only problem right now, I think filing an issue is better than blocking this change at this stage so we can move on to the rest of the incremental=true work - it will only affect select one from map and geotrace/geoshape in field lists and we can improve later.

@dbemke
Copy link

dbemke commented Dec 4, 2025

I think filing an issue is better than blocking this change at this stage

I filed a separate issue ##6982 but I'm mentioning it also here as this issue is a potential "data loss" one (the geometry in geopoint, geotrace and geoshape isn't saved after using select one form map on a field list).

@seadowg
Copy link
Member Author

seadowg commented Dec 4, 2025

@dbemke oh wow! That would be a blocker as it'd be a big regression. I'll copy that in here and close the issue.

@seadowg
Copy link
Member Author

seadowg commented Dec 4, 2025

Issue from @dbemke:

Unable to save geopoint/trace/shape after saving select one from map on a field list

XRecorder_04122025_074724.mp4

Steps to reproduce the problem

  1. Scan the draft of the form. https://test.getodk.cloud/projects/629/forms/Select%20fieldlist/draft
  2. Open the form and go to select one from map question in select a point and save it.
  3. Try to save geometry in geopoint, geoshape or geotrace.

@dbemke
Copy link

dbemke commented Dec 4, 2025

Filling question after select one from map questions doubles questions on a field list.
(The issue doesn't occur on the master version)

XRecorder_04122025_100337.mp4

Steps to reproduce:

  1. Scan user "geo" https://test.getodk.cloud/projects/385/form-access
  2. Go to "relevant on select on from map field list" or "select one from map field list" form.
    relevantOn selectOneFromMap fieldlist.xlsx
    selectOneFromMap fieldlist.xlsx
    cities.geojson.txt
  3. Open the map and select a point.
  4. When moved to the field list enter something in child’s birthweight.

@seadowg
Copy link
Member Author

seadowg commented Dec 4, 2025

@dbemke I'm going to just revert to the version that scrolls back to the top when returning from the selection map. As far as I can tell, that version didn't exhibit either of those two (pretty bad) bugs. We can file the scroll issue separately after merging this and that lets us move on to getting the rest of the incremental=true stuff built out and into people's hands for playing around with.

@dbemke
Copy link

dbemke commented Dec 5, 2025

Tested with Success!

Verified on devices with Androids: 7.1.1, 8.1, 10

Verified cases:

  • select one from map with different points, traces and shapes
  • large datasets in select one from map
  • filtering large dataset in select one from map
  • calculation in a form based on select one from map choice
  • select one from map on a field-list
  • encrypted geopoint on the form map
  • relevance, constraint and required on select one from map question
  • quick appearance
  • regression checks in the form map
  • regression checks in audit logs, savepoints

@WKobus
Copy link

WKobus commented Dec 5, 2025

Tested with success

Verified on Android 16, 11

formController.stepToNextScreenEvent();
}

updateIndex(true, null);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This refreshes the entire screen instead of comparing all the questions and updating only when necessary. I think it has performance implications and isn’t what we want to keep, right?

Copy link
Member Author

@seadowg seadowg Dec 8, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's correct. There most likely will be two changes to performance:

  1. We "recompute" (commit an answer, recalculate dependent calculations, fire events etc) on a background thread instead of a foreground thread which blocks the UI (with a loading animation)
  2. Instead of the smarter re-rendering done by field lists on every change (on every keystroke for example) we re-render the whole "page" (as you point out)

I think 2 will have some impact on larger field lists, but personally it feels like an allowable trade-off for now? It will only affect "select one from map" and (eventually) geotrace/shape questions in the next release and I think the context of returning from one screen to another will most likely make this hard to notice. I initially did try to reuse the code field list re-render code here, but ran into multiple problems, and it felt like fixes would introduce a lot of risk to solve a pretty isolated problem. We could look to improve performance as part of our fix for #6984 (which I think we can do in parallel to other invalid polygon stuff once this merged), and it might actually be the best route to a fix.

Either way, I still feel comfortable with the performance regression for just those two question types (and just in field lists).

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I’m not happy with how this works at the moment, and it’s not how it should be in the long run. However, if it’s preventing you from making progress on the polygons, we can leave it as is for now, just let’s make sure we revisit it shortly afterward

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Understood! I'll add a note to #6984 to make sure the potential performance regression is captured as well.

@seadowg seadowg requested a review from grzesiek2010 December 8, 2025 12:47
Copy link
Member

@grzesiek2010 grzesiek2010 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@seadowg seadowg requested a review from grzesiek2010 December 9, 2025 09:16
@grzesiek2010 grzesiek2010 merged commit 8a17740 into getodk:master Dec 9, 2025
7 checks passed
@seadowg seadowg deleted the widget-answer branch December 9, 2025 10:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants