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

unhashable type: 'list' when a group changes to a question #229

Open
jnm opened this issue Feb 4, 2021 · 0 comments
Open

unhashable type: 'list' when a group changes to a question #229

jnm opened this issue Feb 4, 2021 · 0 comments
Labels

Comments

@jnm
Copy link
Member

jnm commented Feb 4, 2021

Probably related to #151, but in this case a project with 13k submissions had a single submission where a/b/c/name was a group containing three responses:

  1. 'a/b/c/name/q1': 'response 1'
  2. 'a/b/c/name/q3': 'response 2'
  3. 'a/b/c/name/q2': 'response 3'

In every other submission, a/b/c/name was a question, i.e. the submission data contained 'a/b/c/name': 'response'. This discrepancy caused exports to fail with unhashable type: 'list':

TypeError: unhashable type: 'list'
  File "kpi/models/import_export_task.py", line 116, in run
    self._run_task(msgs)
  File "kpi/models/import_export_task.py", line 565, in _run_task
    for line in export.to_csv(submission_stream):
  File "formpack/reporting/export.py", line 477, in to_csv
    for chunk in self.parse_submissions(submissions):
  File "formpack/reporting/export.py", line 139, in parse_submissions
    formatted_chunks = self.parse_one_submission(submission)
  File "formpack/reporting/export.py", line 130, in parse_one_submission
    return self.format_one_submission([submission.data], section)
  File "formpack/reporting/export.py", line 341, in format_one_submission
    cells = field.format(val, _lang)
  File "formpack/schema/fields.py", line 651, in format
    val = self.get_translation(val, lang)
  File "formpack/schema/fields.py", line 641, in get_translation
    translation = self.choice.options[val]['labels'][lang]

https://sentry.kbtdev.org/kobo/unhcr-kpi-backend/issues/329314/?query=is%3Aunresolved%20unhashable

@jnm jnm added the bug label Feb 4, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant