Skip to content
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

Copy library asset content before parsing it #2823

Conversation

jnm
Copy link
Member

@jnm jnm commented Oct 6, 2020

…when importing a library asset into a survey.

Asking for a review from @duvld, since we worked on this together, but will give the final 👍👎 to fresh-eyed @magicznyleszek.

Checklist

  1. ❓ If you've added code that should be tested, add tests
  2. If you've changed APIs, update (or create!) the documentation
  3. ❓ Ensure the tests pass
  4. Make sure your code lints and you followed our coding style
  5. If this is a big feature, make sure to prefix the title with Feature: and add a thorough description for non-dev folk

Description

Fixes bug that made it impossible to add more than one library question to a survey using the form builder if either the survey or the library question had a named translation

Related issues

Fixes #2822

…when importing a library asset into a survey. Fixes #2822
Copy link
Member

@duvld duvld left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 looks good, I cannot produce a null translation from adding questions from the library.
Tried to generate a null translation by adding the following into the form and saving:

  • blocks with multiple translations,
  • questions with multiple translations,
  • questions that have form's default language but not as default,
  • different combinations of blocks and groups with translations

The only way I can generate a null translation in the library is through #2821, or adding translated library questions to a form with no named translations (both are beyond the scope here)

In regards to tests, (in a quick search) there's not many that test loadDict() but there's a whole suite that tests inputParser wrt translations: https://github.com/kobotoolbox/kpi/blob/master/test/xlform/inputParser.tests.coffee that are run by travis.

@magicznyleszek
Copy link
Member

@jnm I love the comments you've added <3

@magicznyleszek magicznyleszek merged commit 43b5ef7 into master Oct 6, 2020
@magicznyleszek magicznyleszek deleted the 2822-copy-library-asset-content-before-adding-to-survey branch October 6, 2020 20:11
@jnm
Copy link
Member Author

jnm commented Oct 7, 2020

Thank you, @duvld 👍 I wonder if @dorey could comment on how code like addExternalItemAtPosition(), which bridges the ES6 React stuff with CoffeeScript / Backbone code, ought to be tested.

edit: started discussion at https://chat.kobotoolbox.org/#narrow/stream/4-KoBo-Dev/topic/Tests.20at.20ES6-CoffeeScript.20boundary

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Library items are mutated when added to a survey from the sidebar
3 participants