Closed lindsay-stevens closed 2 years ago
Merging #571 (eb6f0fe) into master (bb2497d) will increase coverage by
0.19%
. The diff coverage is87.32%
.
@@ Coverage Diff @@
## master #571 +/- ##
==========================================
+ Coverage 83.59% 83.79% +0.19%
==========================================
Files 25 26 +1
Lines 3761 3825 +64
Branches 930 952 +22
==========================================
+ Hits 3144 3205 +61
Misses 474 474
- Partials 143 146 +3
Impacted Files | Coverage Δ | |
---|---|---|
pyxform/xls2json.py | 79.82% <80.00%> (+0.35%) |
:arrow_up: |
...m/validators/pyxform/missing_translations_check.py | 86.20% <86.20%> (ø) |
|
pyxform/aliases.py | 100.00% <100.00%> (ø) |
|
pyxform/constants.py | 100.00% <100.00%> (ø) |
|
pyxform/section.py | 96.58% <100.00%> (+0.02%) |
:arrow_up: |
pyxform/survey.py | 94.37% <0.00%> (+0.58%) |
:arrow_up: |
Continue to review full report at Codecov.
Legend - Click here to learn more
Δ = absolute <relative> (impact)
,ø = not affected
,? = missing data
Powered by Codecov. Last update bb2497d...eb6f0fe. Read the comment docs.
Pretty clean approach! I am still worried that _add_empty_translations
in survey.py
must be doing essentially the same work, but this leaves the separation of concerns much cleaner (maybe _add_empty_translations
could be done here somehow and removed from survey.py?)
The added testing is pretty helpful!
Hi @KeynesYouDigIt thanks for your review! Please let me know if any changes or further clarification are needed.
@lindsay-stevens no im good, this all seems fine! I'm afraid I don't have official review permissions so someone else will have to do the official review.
Hi @lognaturel would you be able to review?
Will do!
I believe dashes are filled in for labels because Validate requires a label for every language.
Hi @lognaturel just a reminder about this - no worries if it's til the new year. Thanks!
Hi @lognaturel happy new year! Just a reminder about this PR ready for review.
Thanks for reviewing @lognaturel! I've replied to each comment, please let me know if any changes are needed at this stage (or via separate tickets).
@lognaturel thanks for the feedback / discussion above. The outstanding items should all now be addressed, either by new commits or new tickets for follow up.
Closes #157
Adds a warning if it looks like a XLSForm is missing a translation on one or more translatable columns.
The originating issue was a test case concerning only survey
label
andmedia::image
. This PR covers all translatable columns (per the Reference Table. On the survey sheet: label, hint, guidance_hint, media::image, media::audio, media::video, constraint_message, and required_message. On the choices sheet: label, media::image, media::audio, and media::video.The warning message specifies the columns and languages which appear to be missing. The (unwrapped) template is:
Where
{cols_msg}
lists the columns (for either or both ofsurvey
andchoices
) separated by a semicolon and the languages separated by a comma, e.g.'hint': 'English', 'French'; 'label': 'English'
. It can be a bit difficult to read when there are a lot of missing columns / languages but I'm not sure of a better alternative, such as using list notation (square brackets) etc. However, presenting the warning like this seems preferable to emitting a separate warning for each column. Example:Why is this the best possible solution? Were any other approaches considered?
It would have been a good outcome if there was clearly a way that pyxform could produce an XForm that avoided the issue that the warning is for. However there were not many tests for translations previously. This made it difficult to tell whether aspects of and differences in XLSForm input and XForm output were symptoms of the originating issue, or normal behaviour, or undiscovered bugs.
This PR includes a raft of relatively pedantic XPath tests for translations behaviour. There are probably still more permutations that don't have tests but this should be a good boost to test coverage. In
test_translations.py
there are some TODO comments which should be reviewed and converted to tickets if they represent genuine bugs, or removed if they note normal behaviour. Once the TODO's are resolved, maybe it would be possible for pyxform to emit an XForm such that the warning is not required.What are the regression risks?
Some users may expect no warning for certain XLSForms with missing translation columns. Depending on how warnings are handled it may or may not be a problem. The changes in this PR are otherwise additive.
Does this change require updates to documentation? If so, please file an issue here and include the link below.
The
guidance_hint
column was missing from the XLSForm Reference Table but I've submitted a PR for that already.Before submitting this PR, please make sure you have:
tests
nosetests
and verified all tests passblack pyxform tests
to format code