-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Resolves #4500 autocomplete minimal… #4712
Conversation
The test_app failure is puzzling as it passed for my original commits. |
I'm relieved to find that no one seems yet to have looked at this - I realised today that the core code can be reworked into something much simpler. Please watch this space! |
That's exciting! Apologies for the general radio silence. I'm not sure whether you've seen but I now have a newborn so my availability and sanity are low. Other folks are taking much-needed time off and working on a less intense release! We so appreciate all of what you've been up to here. 🙏
Please let us know if we can help. If your I saw somewhere that you had recommended an order for reviewing open PRs but I can't find it again. Is what you write here the best order to follow? |
Having been alerted to the idea of keeping the PR list as tidy as possible, I'm closing this one for now. |
Resolves #4500
This documents a revision of #4673 now closed.
What has been done to verify that this works as intended?
Tested with new
SelectOneResetTest
.Why is this the best possible solution? Were any other approaches considered?
See design notes below.
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?
Improvement to behaviour from user perspective.
No apparent regression risks.
Do we need any specific form for testing your changes? If so, please attach one.
selectOneReset.zip
Does this change require updates to documentation? If so, please file an issue here and include the link below.
Perhaps form design advice could specify the benefits and limitations of the improved behaviour?
Before submitting this PR, please make sure you have:
./gradlew checkAll
and confirmed all checks still pass OR confirm CircleCI build passes and run./gradlew connectedDebugAndroidTest
locally.Design notes
A lot of stuff here, but both the issue and the proposed resolution have turned out to be quite complex.
The issue
A shout out to @aurdipas for a form that demonstrates clearly the undesired behaviour of selects with fast external itemsets.
Most obviously, answers for cascades using fast external itemsets don't reset (or at best not immediately) when preceding members are updated, in constrast to their behaviour with internal itemsets.
This behaviour is most glaringly apparent with minimal appearances, especially in field lists - plain select widgets do reset when they can’t match an existing value in their current choices.
Desirable if less obvious behaviours also implied by the form are that
And all this should work inside groups and especially field lists; the hierarchy views should be reset immediately upon each change.
Not only may the current behaviour confuse the user, it permits saving of incoherent data.
So a resolution to this issue must focus on resetting the answers for a complete cascade, rather than just ensuring that widgets reset when rendered.
The update
Preparatory changes
clearFollowingItemsetWidgets
inSelectOneWidget
sort of resets succeding cascade members, but hitherto there’s been no equivalent in
SelectOneMinimalWidget
.So to start with I recycled
clearFollowingItemsetWidgets
:ItemsWidget
SelectOneMinimalWidget
by analogy withSelectOneWidget
Widget sequences (one per view)
SelectOneWidgetUtils
now hascheckFastExternalCascade
, called (for now) from a stubclearFollowingItemsetWidgets
, of which it extends the original algorithm.The new method:
Field lists
The basic fix aborts silently when the cascade is in a field list as in the issue form.
In
FormEntryActivity
,updateFieldListQuestions
currently resets only the next cascade member (possibly as a side effect?).In this improvement it calls
checkFastExternalCascadeInFieldList
, also living inSelectOneWidgetUtils
, and implementing the same algorithm ascheckFastExternalCascade
; except that hidden questions are reset when unhidden.Testing
The issue appears resolved as outlined above when changes are tested manually against the issue form (when slightly modified with no cascade splitting between groups).
For formal testing there are numerous potential use cases, representing combinations of:
Test form
The form derives from selectOneExternal.zip from #4258 - thanks @mmarciniak90. It covers
The workbook includes these supporting sheets:
Test class
SelectOneResetTest
borrows extensively fromFieldListUpdateTest
. In each block it makes changes and asserts expected outcomes as set out in the workbook asserts sheet.The
SectionVariant
enum
combines anitemset
based on the type of its section with anappearance
from the appearance.The
Block
enum
provides the appropriate strings for eachSectionVariant
.The single test method iterates through the variants, thus visiting all sections of the prefilled form and running logically equivalent tests against the context blocks comprising each section.
Tests are identified in the code as detailed in the workbook asserts sheet.
The code makes use of new convenience methods in
FormEntryPage
that wrap useful formulations found inFieldListUpdateTest
.SelectOneResetTest
can be validated by running against the current codebase and checking that it fails where expected.