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

"Mismatched labels and translations" export failure when select_*_from_file present in multi-langauge forms #322

Closed
jnm opened this issue Jun 15, 2024 · 0 comments · Fixed by #323
Assignees

Comments

@jnm
Copy link
Member

jnm commented Jun 15, 2024

It looks like what happened is that MEDIA_TYPES was originally added with the right stuff:

MEDIA_TYPES = ('audio', 'image', 'video')

And then, in the same PR, those were prefixed with media:: and added to the list of translated columns 🆗
https://github.com/kobotoolbox/formpack/pull/280/files#diff-5382e2c7532fd5627ec49791c7f53cc8c5a39f865903c702bf1151be4dccfd99R177-R194

However, yours truly recently saw that we had two constants both named MEDIA_TYPES and thought that one was just an incomplete version of the other. So, I metí la pata and combined them in #321, which is the real source of the current problem.

We clearly need two constants: one for all question types that collect media files (that's what MEDIA_TYPES is currently, after #321), and another constant for media COLUMN names.

We also need, unfortunately, special handling for existing asset versions that have media::file in the translated list 😐 in order to work around the existing damage.

To reproduce the problem, create an XLSForm with this in the survey sheet:

type name label::Ukrainian label::English
text interviewer_name_text Введіть ім'я співробітника: Enter interviewer's name
select_one_from_file oblast.csv oblast Область Oblast

Create oblast.csv with the following contents:

name label::Ukrainian label::English
ck Черкаська Cherkasy
zht Житомирська Zhytomyr

Import the XLSForm into KoboToolbox and add oblast.csv as a form media file. Deploy, and create a submission. Attempt to export, see the following failure:

formpack.errors.TranslationError: Mismatched labels and translations: [Введіть ім'я співробітника:, Enter interviewer's name] [Ukrainian, English, None] 2!=3

Internal discussion: https://chat.kobotoolbox.org/#narrow/stream/4-Kobo-Dev/topic/Critical.20export.20failure

@jnm jnm self-assigned this Jun 15, 2024
jnm added a commit that referenced this issue Jun 15, 2024
`Mismatched labels and translations` error when attempting to load a
schema that contains multiple languages as well as a
`select_one_from_file` or `select_multiple_from_file` that has been
expanded to have a `file` column as performed by #314
jnm added a commit that referenced this issue Jun 15, 2024
types!

This fixes #322 for new schemas, but doesn't yet handle existing schemas
that have a superfluous `None` translation
jnm added a commit that referenced this issue Jun 16, 2024
This needs to be applied to existing content
@jnm jnm closed this as completed in #323 Jun 17, 2024
jnm added a commit to kobotoolbox/kpi that referenced this issue Jun 17, 2024
jnm added a commit to kobotoolbox/kpi that referenced this issue Jun 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
1 participant