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

#653 Detection of multilanguage choices only works if first choice list is multilanguage #666

Merged
merged 4 commits into from
Dec 1, 2023

Commits on Nov 20, 2023

  1. chg: refactor translation detection

    - overall goal is to avoid using only the first few lines of survey
      or choices sheet data to decide whether to use multi-language
      behaviour (itext) or not.
    - xls2json.py: re-use dealias func for finding headers as well as data
    - translation_checks.py: use headers data to find translations
    - survey.py:
      - declare _translations key and store and translations info in it
      - tidy setup_translations to data prep vs. _translations update steps
      - add translation type key to help differentiate question vs choice
      - annotate survey elements with info about translations, dynamic
        choices, and media, so that this doesn't need to be re-checked later
        by individual elements.
      - decide whether to emit itext labels for choices on a per-itemset
        basis, rather than switching into itext mode for all choices. This
        avoids needing to mangle untranslated itemsets into translated when
        other itemsets in the survey are translated (otherwise they would
        get no itext, not even a hypen "-").
      - add lru_cache upper limit so that it doesn't grow forever
      - update add_to_nested_dict to allow updating existing dict
    - question.py:
      - declare translations, dynamic choices, and media keys set by survey
        and use them to determine relevant behaviour instead of re-checking
    - utils.py: remove multi-language parameter from has_dynamic_label
      because it's clearer to do the same logic external to the function.
    - add tests for multi-language detection + with media
    lindsay-stevens committed Nov 20, 2023
    Configuration menu
    Copy the full SHA
    c99a2f9 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    f353d54 View commit details
    Browse the repository at this point in the history
  3. chg: use more performant data type for finding element lineage

    - For insert/pop on the left side: O(1) for deque vs. O(n) for list.
    - Avoids creating lots of new lists with [] + [].
    - Did not investigate whether the "flat" filter is still necessary.
    lindsay-stevens committed Nov 20, 2023
    Configuration menu
    Copy the full SHA
    26026a6 View commit details
    Browse the repository at this point in the history
  4. fix: return type change for dealias_and_group_headers for entities sheet

    - needed after rebase on latest master
    lindsay-stevens committed Nov 20, 2023
    Configuration menu
    Copy the full SHA
    05ad654 View commit details
    Browse the repository at this point in the history