-
-
Notifications
You must be signed in to change notification settings - Fork 218
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
fix(#8225): fix handling of inputs
group with contact selector
#9382
Merged
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
cccdc3a
Update patch for Enekto relevant logic to prevent `inputs` from ever …
jkuester 6b56609
Fix delivery assertion to use expected contact name
jkuester 6f2519e
Add e2e test covering loading contacts in non-relevant inputs group
jkuester 3a751bf
Fix page handling when inputs becomes non-relevant
jkuester bab344d
Merge branch 'refs/heads/master' into 8225_update_relevant_patch
jkuester ac1ea08
Change db_object_form name to db-object-form
jkuester File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
<?xml version="1.0"?> | ||
<h:html xmlns="http://www.w3.org/2002/xforms" xmlns:cht="https://communityhealthtoolkit.org" xmlns:ev="http://www.w3.org/2001/xml-events" xmlns:h="http://www.w3.org/1999/xhtml" xmlns:jr="http://openrosa.org/javarosa" xmlns:orx="http://openrosa.org/xforms" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> | ||
<h:head> | ||
<h:title>DB Object Form</h:title> | ||
<model> | ||
<itext> | ||
<translation lang="en"> | ||
<text id="/db-object-form/people/person_test_all:label"> | ||
<value>Select a person from all</value> | ||
</text> | ||
<text id="/db-object-form/people/person_test_same_parent:label"> | ||
<value>Select a person from the same parent</value> | ||
</text> | ||
</translation> | ||
</itext> | ||
<instance> | ||
<db-object-form delimiter="#" id="db-object-form" prefix="J1!db-object-form!" version="2024-09-05 00:00:00"> | ||
<inputs> | ||
<meta> | ||
<location> | ||
<lat/> | ||
<long/> | ||
<error/> | ||
<message/> | ||
</location> | ||
</meta> | ||
<user> | ||
<contact_id/> | ||
<name/> | ||
<sex/> | ||
</user> | ||
<user_contact> | ||
<_id/> | ||
<name/> | ||
<sex/> | ||
</user_contact> | ||
</inputs> | ||
<people> | ||
<user_contact> | ||
<_id/> | ||
<name/> | ||
<sex/> | ||
</user_contact> | ||
<person_test_same_parent/> | ||
<person_test_all/> | ||
</people> | ||
<meta tag="hidden"> | ||
<instanceID/> | ||
</meta> | ||
</db-object-form> | ||
</instance> | ||
<instance id="contact-summary"/> | ||
<bind nodeset="/db-object-form/inputs" relevant="false()"/> | ||
<bind nodeset="/db-object-form/inputs/user/contact_id" type="string"/> | ||
<bind nodeset="/db-object-form/inputs/user/name" type="string"/> | ||
<bind nodeset="/db-object-form/inputs/user/sex" type="string"/> | ||
<bind calculate="../../user/contact_id" nodeset="/db-object-form/inputs/user_contact/_id" type="string"/> | ||
<bind nodeset="/db-object-form/inputs/user_contact/name" type="string"/> | ||
<bind nodeset="/db-object-form/inputs/user_contact/sex" type="string"/> | ||
<bind calculate="../../../inputs/user/contact_id" nodeset="/db-object-form/people/user_contact/_id" type="string"/> | ||
<bind nodeset="/db-object-form/people/user_contact/name" type="string"/> | ||
<bind nodeset="/db-object-form/people/user_contact/sex" type="string"/> | ||
<bind nodeset="/db-object-form/people/person_test_same_parent" type="string"/> | ||
<bind nodeset="/db-object-form/people/person_test_all" type="string"/> | ||
<bind calculate="concat('uuid:', uuid())" nodeset="/db-object-form/meta/instanceID" readonly="true()" type="string"/> | ||
</model> | ||
</h:head> | ||
<h:body class="pages"> | ||
<group ref="/db-object-form/inputs"> | ||
<group ref="/db-object-form/inputs/user"> | ||
<input appearance="hidden select-contact type-person" ref="/db-object-form/inputs/user/contact_id"/> | ||
</group> | ||
<group ref="/db-object-form/inputs/user_contact"> | ||
<input appearance="hidden select-contact type-person" ref="/db-object-form/inputs/user_contact/_id"/> | ||
</group> | ||
</group> | ||
<group appearance="field-list" ref="/db-object-form/people"> | ||
<group ref="/db-object-form/people/user_contact"> | ||
<input appearance="hidden select-contact type-person" ref="/db-object-form/people/user_contact/_id"/> | ||
</group> | ||
<input appearance="select-contact type-person descendant-of-current-contact" ref="/db-object-form/people/person_test_same_parent"> | ||
<label ref="jr:itext('/db-object-form/people/person_test_same_parent:label')"/> | ||
</input> | ||
<input appearance="select-contact type-person" ref="/db-object-form/people/person_test_all"> | ||
<label ref="jr:itext('/db-object-form/people/person_test_all:label')"/> | ||
</input> | ||
</group> | ||
</h:body> | ||
</h:html> |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This change actually demonstrates this fix in action! The regression scenario from the forum was doing the exact same thing as the
delivery
form where they are trying to load the user's contact document directly into theinputs/user
group. The complication is that theinputs/user
group already contains data from the usersuser-settings
doc. So, when you use the contact selector to load the user's contact into the same group, it will override the data that is already there.In this case, both the user's contact and the
user-settings
document contain aname
field. For theuser-settings
it is the username. For the contact, it is just the normal contact name value. Because the contact-selector functionality in non-relevantinputs
was broken before this PR, the user's contact data was not actually being loaded and so thename
was just populated with the username from theuser-settings
document. Now that this PR has fixed the contact selector functionality, we seeinputs/user/name
getting overridden with the value from the user's contact (which is the proper behavior that we expect).