kobotoolbox / kpi

kpi is the server for KoboToolbox. It includes an API for users to access data and manage their forms, question library, sharing settings, create reports, and export data.
https://www.kobotoolbox.org
GNU Affero General Public License v3.0
133 stars 181 forks source link

Issues related to formbuilder and adding questions from the library #2800

Open duvld opened 4 years ago

duvld commented 4 years ago

Description

The formbuilder + Library imports have a couple of issues outlined below:

🟢 - fix/good
🟡 - passable
🔴 - not fixed
  1. 🟢 (PR: #2820 is merged) in any form, if you're in the form builder and have the library sidebar open, clicking SAVE causes the current form to be added to the list of importable library items

  2. 🟢 when importing a library item using the form builder, all the translations for that library item do in fact come with it into the form. if the library item contains a language that isn't part of the form already, that language gets added

  3. 🟡 if the library item does not have the language currently being used by the form builder, then the XML / "data column" name gets used as the label instead

  4. 🟢 (#2822 is fixed) it's impossible to add more than one library question to a survey using the form builder if either the survey or the library question has a named translation (There is an unnamed translation in your form definition exception gets thrown; see https://github.com/kobotoolbox/kpi/blob/0deff9668027e73ecc7199132cee908ce25a41b8/jsapp/js/utils.es6#L161)

    • BUT, if you save and refresh, you can add another question
    • and, if your survey has only a null translation and your library question has only a null translation, you can add as many as you like
  5. 🟢 (PR: #2825 is merged) if you have a survey that has both a null translation as the default and one or more named translations, the "Manage Languages" modal functions in an unhelpful way. it says "Please name your default language before adding languages and translations", but it provides no list of existing translations, leading to "Name/Code must be unique!" errors

  6. 🟡 (#2826 no bad consequences, see internal discussion) start and end are added to a library item even when adding a single question from scratch using the UI

Additional details

Here's the simplest form that would produce the bug: name-used-not-label.xlsx

Here's a more "real" example to test on: https://github.com/kobotoolbox/kpi/files/5168787/collection_small.xlsx

jnm commented 4 years ago

Found #2821 while working on this