-
Notifications
You must be signed in to change notification settings - Fork 76
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
Warn about <2024.1 entities spec and update tests #1272
Merged
Merged
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 |
---|---|---|
|
@@ -346,6 +346,30 @@ module.exports = { | |
</h:html>`, | ||
|
||
simpleEntity: `<?xml version="1.0"?> | ||
<h:html xmlns="http://www.w3.org/2002/xforms" xmlns:h="http://www.w3.org/1999/xhtml" xmlns:jr="http://openrosa.org/javarosa" xmlns:entities="http://www.opendatakit.org/xforms"> | ||
<h:head> | ||
<model entities:entities-version="2024.1.0"> | ||
<instance> | ||
<data id="simpleEntity" orx:version="1.0"> | ||
<name/> | ||
<age/> | ||
<hometown/> | ||
<meta> | ||
<entity dataset="people" id="" create=""> | ||
<label/> | ||
</entity> | ||
</meta> | ||
</data> | ||
</instance> | ||
<bind nodeset="/data/name" type="string" entities:saveto="first_name"/> | ||
<bind nodeset="/data/age" type="int" entities:saveto="age"/> | ||
<bind nodeset="/data/hometown" type="string"/> | ||
</model> | ||
</h:head> | ||
</h:html>`, | ||
|
||
// Copy of the above form with the original entities-version | ||
simpleEntity2022: `<?xml version="1.0"?> | ||
<h:html xmlns="http://www.w3.org/2002/xforms" xmlns:h="http://www.w3.org/1999/xhtml" xmlns:jr="http://openrosa.org/javarosa" xmlns:entities="http://www.opendatakit.org/xforms"> | ||
<h:head> | ||
<model entities:entities-version="2022.1.0"> | ||
|
@@ -371,7 +395,7 @@ module.exports = { | |
multiPropertyEntity: `<?xml version="1.0"?> | ||
<h:html xmlns="http://www.w3.org/2002/xforms" xmlns:h="http://www.w3.org/1999/xhtml" xmlns:jr="http://openrosa.org/javarosa" xmlns:entities="http://www.opendatakit.org/xforms"> | ||
<h:head> | ||
<model entities:entities-version="2022.1.0"> | ||
<model entities:entities-version="2024.1.0"> | ||
<instance> | ||
<data id="multiPropertyEntity" orx:version="1.0"> | ||
<q1/> | ||
|
@@ -394,6 +418,29 @@ module.exports = { | |
</h:html>`, | ||
|
||
updateEntity: `<?xml version="1.0"?> | ||
<h:html xmlns="http://www.w3.org/2002/xforms" xmlns:h="http://www.w3.org/1999/xhtml" xmlns:jr="http://openrosa.org/javarosa" xmlns:entities="http://www.opendatakit.org/xforms"> | ||
<h:head> | ||
<model entities:entities-version="2024.1.0"> | ||
<instance> | ||
<data id="updateEntity" orx:version="1.0"> | ||
<name/> | ||
<age/> | ||
<hometown/> | ||
<meta> | ||
<entity dataset="people" id="" update="" baseVersion="" branchId="" trunkVersion=""> | ||
<label/> | ||
</entity> | ||
</meta> | ||
</data> | ||
</instance> | ||
<bind nodeset="/data/name" type="string" entities:saveto="first_name"/> | ||
<bind nodeset="/data/age" type="int" entities:saveto="age"/> | ||
</model> | ||
</h:head> | ||
</h:html>`, | ||
|
||
// Copy of the above form with the original entities-version spec | ||
updateEntity2023: `<?xml version="1.0"?> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I kind of think it'd be nice not to duplicate the XML if we don't have to. What if we did something like: testData.forms.updateEntity2023 = testData.forms.updateEntity.replace('2024.1.0', '2023.1.0'); No strong feelings if you prefer to keep it the way it is. |
||
<h:html xmlns="http://www.w3.org/2002/xforms" xmlns:h="http://www.w3.org/1999/xhtml" xmlns:jr="http://openrosa.org/javarosa" xmlns:entities="http://www.opendatakit.org/xforms"> | ||
<h:head> | ||
<model entities:entities-version="2023.1.0"> | ||
|
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
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 see that the lines above and below this one use
await
, but ifForms.checkDatasetWarnings()
doesn't need to be async and return a promise, I think it'd be nice to remove theawait
. I think code is often clearer when things can be done sync.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'm stuck on how to not make this return a promise and not await it. It doesn't strictly need to be this way but it fits with
checkMeta
,checkDeletedForms
, andcheckStructuralChange
in checking something and modifying thecontext
on the container. (checkDeletedForms
makes a DB call though so it does need to be this way.)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.
In
checkDatasetWarnings()
, you can removeasync
, then replacereturn resolve();
withreturn;
. After that, you can removeawait
here.checkDeletedForms()
definitely needs to be async, but I don't think the other two do.checkMeta()
callsreject()
, but it could justthrow
. I think it's a little confusing that these functions are async, and I'd love to refactor them sometime. I don't think that time is now though! But it'd be great not to add another instance of this pattern.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.
Following up something we talked about in review: changing this function to not return a promise leads to this error:
at these lines in the container. I could change these lines to use
?.
but I'll leave it as is for now.