This repository has been archived by the owner on Nov 29, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 91
[Fix] Ensure nested repeats are shown when relevance is true #807
Draft
eyelidlessness
wants to merge
2
commits into
enketo:master
Choose a base branch
from
eyelidlessness:fix/issue-804-nested-repeat-relevance-redux
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,155 @@ | ||
<?xml version="1.0"?> | ||
<h:html xmlns="http://www.w3.org/2002/xforms" xmlns:ev="http://www.w3.org/2001/xml-events" xmlns:h="http://www.w3.org/1999/xhtml" xmlns:jr="http://openrosa.org/javarosa" xmlns:odk="http://www.opendatakit.org/xforms" xmlns:orx="http://openrosa.org/xforms" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> | ||
<h:head> | ||
<h:title>enketo-repeat-bug</h:title> | ||
<model odk:xforms-version="1.0.0"> | ||
<instance><data id="enketo-repeat-bug" version="2021081700"> | ||
<field_asset_exists /> | ||
<field_asset_rpt jr:template=""> | ||
<field_asset_rpt_grp> | ||
<asset_name /> | ||
<documentation_exists /> | ||
<documentation_rpt jr:template=""> | ||
<documentation_rpt_grp> | ||
<documentation_type /> | ||
<documentation_file /> | ||
<documentation_photo /> | ||
</documentation_rpt_grp> | ||
</documentation_rpt> | ||
<documentation_rpt> | ||
<documentation_rpt_grp> | ||
<documentation_type /> | ||
<documentation_file /> | ||
<documentation_photo /> | ||
</documentation_rpt_grp> | ||
</documentation_rpt> | ||
<instrumentation_exists /> | ||
<instrumentation_rpt jr:template=""> | ||
<instrumentation_rpt_grp> | ||
<instrumentation_tag /> | ||
<instrumentation_measurement /> | ||
<instrumentation_measurement_other /> | ||
</instrumentation_rpt_grp> | ||
</instrumentation_rpt> | ||
<instrumentation_rpt> | ||
<instrumentation_rpt_grp> | ||
<instrumentation_tag /> | ||
<instrumentation_measurement /> | ||
<instrumentation_measurement_other /> | ||
</instrumentation_rpt_grp> | ||
</instrumentation_rpt> | ||
</field_asset_rpt_grp> | ||
</field_asset_rpt> | ||
<field_asset_rpt> | ||
<field_asset_rpt_grp> | ||
<asset_name /> | ||
<documentation_exists /> | ||
<documentation_rpt> | ||
<documentation_rpt_grp> | ||
<documentation_type /> | ||
<documentation_file /> | ||
<documentation_photo /> | ||
</documentation_rpt_grp> | ||
</documentation_rpt> | ||
<instrumentation_exists /> | ||
<instrumentation_rpt> | ||
<instrumentation_rpt_grp> | ||
<instrumentation_tag /> | ||
<instrumentation_measurement /> | ||
<instrumentation_measurement_other /> | ||
</instrumentation_rpt_grp> | ||
</instrumentation_rpt> | ||
</field_asset_rpt_grp> | ||
</field_asset_rpt> | ||
<meta> | ||
<instanceID /> | ||
</meta> | ||
</data></instance> | ||
<bind nodeset="/data/field_asset_exists" required="true()" type="string" /> | ||
<bind nodeset="/data/field_asset_rpt" relevant="selected( /data/field_asset_exists , 'yes')" /> | ||
<bind nodeset="/data/field_asset_rpt/field_asset_rpt_grp/asset_name" type="string" /> | ||
<bind nodeset="/data/field_asset_rpt/field_asset_rpt_grp/documentation_exists" required="true()" type="string" /> | ||
<bind nodeset="/data/field_asset_rpt/field_asset_rpt_grp/documentation_rpt" relevant="selected( ../documentation_exists , 'yes')" /> | ||
<bind nodeset="/data/field_asset_rpt/field_asset_rpt_grp/documentation_rpt/documentation_rpt_grp/documentation_type" required="true()" type="string" /> | ||
<bind nodeset="/data/field_asset_rpt/field_asset_rpt_grp/documentation_rpt/documentation_rpt_grp/documentation_file" type="binary" /> | ||
<bind nodeset="/data/field_asset_rpt/field_asset_rpt_grp/documentation_rpt/documentation_rpt_grp/documentation_photo" orx:max-pixels="1000" relevant=" ../documentation_file = ''" type="binary" /> | ||
<bind nodeset="/data/field_asset_rpt/field_asset_rpt_grp/instrumentation_exists" required="true()" type="string" /> | ||
<bind nodeset="/data/field_asset_rpt/field_asset_rpt_grp/instrumentation_rpt" relevant="selected( ../instrumentation_exists , 'yes')" /> | ||
<bind nodeset="/data/field_asset_rpt/field_asset_rpt_grp/instrumentation_rpt/instrumentation_rpt_grp/instrumentation_tag" type="string" /> | ||
<bind nodeset="/data/field_asset_rpt/field_asset_rpt_grp/instrumentation_rpt/instrumentation_rpt_grp/instrumentation_measurement" required="true()" type="string" /> | ||
<bind nodeset="/data/field_asset_rpt/field_asset_rpt_grp/instrumentation_rpt/instrumentation_rpt_grp/instrumentation_measurement_other" relevant="selected( ../instrumentation_measurement , 'other')" required="true()" type="string" /> | ||
<bind jr:preload="uid" nodeset="/data/meta/instanceID" readonly="true()" type="string" /> | ||
</model> | ||
</h:head> | ||
<h:body> | ||
<select1 ref="/data/field_asset_exists"><label>Is there at least 1 field asset?</label> | ||
<item><label>Yes</label> | ||
<value>yes</value> | ||
</item> | ||
<item><label>No</label> | ||
<value>no</value> | ||
</item> | ||
</select1> | ||
<group ref="/data/field_asset_rpt"><label>Field asset</label> | ||
<repeat nodeset="/data/field_asset_rpt"> | ||
<group ref="/data/field_asset_rpt/field_asset_rpt_grp"><label><output value=" ../field_asset_rpt_grp/asset_name " /></label><input ref="/data/field_asset_rpt/field_asset_rpt_grp/asset_name"><label>Asset name</label></input> | ||
<select1 ref="/data/field_asset_rpt/field_asset_rpt_grp/documentation_exists"><label>Is there at least 1 piece of documentation?</label> | ||
<item><label>Yes</label> | ||
<value>yes</value> | ||
</item> | ||
<item><label>No</label> | ||
<value>no</value> | ||
</item> | ||
</select1> | ||
<group ref="/data/field_asset_rpt/field_asset_rpt_grp/documentation_rpt"><label>Documentation</label> | ||
<repeat nodeset="/data/field_asset_rpt/field_asset_rpt_grp/documentation_rpt"> | ||
<group ref="/data/field_asset_rpt/field_asset_rpt_grp/documentation_rpt/documentation_rpt_grp"><label><output value=" ../documentation_rpt_grp/documentation_type " /></label> | ||
<select1 ref="/data/field_asset_rpt/field_asset_rpt_grp/documentation_rpt/documentation_rpt_grp/documentation_type"><label>Documentation type</label> | ||
<item><label>Drawing set</label> | ||
<value>drawing_set</value> | ||
</item> | ||
<item><label>Maintenance schedule</label> | ||
<value>maintenance_schedule</value> | ||
</item> | ||
<item><label>Other</label> | ||
<value>other</value> | ||
</item> | ||
</select1> | ||
<upload mediatype="application/*" ref="/data/field_asset_rpt/field_asset_rpt_grp/documentation_rpt/documentation_rpt_grp/documentation_file"><label>Documentation file</label> | ||
<hint>If no file available, go to next question to take a photo</hint> | ||
</upload> | ||
<upload mediatype="image/*" ref="/data/field_asset_rpt/field_asset_rpt_grp/documentation_rpt/documentation_rpt_grp/documentation_photo"><label>Documentation photo</label></upload> | ||
</group> | ||
</repeat> | ||
</group> | ||
<select1 ref="/data/field_asset_rpt/field_asset_rpt_grp/instrumentation_exists"><label>Is there at least 1 piece of instrumentation?</label> | ||
<item><label>Yes</label> | ||
<value>yes</value> | ||
</item> | ||
<item><label>No</label> | ||
<value>no</value> | ||
</item> | ||
</select1> | ||
<group ref="/data/field_asset_rpt/field_asset_rpt_grp/instrumentation_rpt"><label>Instrumentation</label> | ||
<repeat nodeset="/data/field_asset_rpt/field_asset_rpt_grp/instrumentation_rpt"> | ||
<group ref="/data/field_asset_rpt/field_asset_rpt_grp/instrumentation_rpt/instrumentation_rpt_grp"><label><output value=" ../instrumentation_rpt_grp/instrumentation_tag " /></label><input ref="/data/field_asset_rpt/field_asset_rpt_grp/instrumentation_rpt/instrumentation_rpt_grp/instrumentation_tag"><label>Instrumentation tag</label> | ||
<hint>If available</hint></input> | ||
<select1 ref="/data/field_asset_rpt/field_asset_rpt_grp/instrumentation_rpt/instrumentation_rpt_grp/instrumentation_measurement"><label>Instrumentation measurement</label> | ||
<item><label>Conductivity</label> | ||
<value>conductivity</value> | ||
</item> | ||
<item><label>Flow</label> | ||
<value>flow</value> | ||
</item> | ||
<item><label>Other</label> | ||
<value>other</value> | ||
</item> | ||
</select1><input ref="/data/field_asset_rpt/field_asset_rpt_grp/instrumentation_rpt/instrumentation_rpt_grp/instrumentation_measurement_other"><label>Specify other instrumentation measurement</label></input> | ||
</group> | ||
</repeat> | ||
</group> | ||
</group> | ||
</repeat> | ||
</group> | ||
</h:body> | ||
</h:html> |
Oops, something went wrong.
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.
I believe the underlying issue is that the first instance of the nested repeat is not created when the top-level repeat (no. 2) is created (after the user clicks the plus button).
The relevant module should not be responsible for fixing that, as it's the responsibility of the repeat module. It's odd that something so elementary is not done correctly. I wonder if this bug was introduced when we started allowing 0 repeat instances. There seems to be some (still mysterious) special condition in the test form, because in e.g. http://localhost:8005/?xform=nested_repeats.xml the bug doesn't surface.
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.
I was hesitant to apply this fix here too, I'm glad you agree. To be honest I chose this path because I struggled to understand the repeat initialization flow and wasn't sure how to address it there. But I'll take another look because I agree it would be better solved there.