kobotoolbox / kpi

kpi is the (frontend) 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 180 forks source link

Filtering select_multiple column in Data Table filters by name but display labels #3897

Open Falnesio opened 2 years ago

Falnesio commented 2 years ago

Description

There is a bug on the data table showing submitted form information athttps://kobo.humanitarianresponse.info On a column for a multiple-choice question, when one is selected starting with the letter A, the filter does not work.

Falnesio commented 2 years ago

I hope this helps. I cut it off to not show more than is needed, but as you can see I am trying to filter by a value that starts with the letter A and it is not filtering for that value. This is a select_one variable.

image

Falnesio commented 2 years ago

Workaround found https://community.kobotoolbox.org/t/submissions-data-table-not-filtering-correctly-https-kobo-humanitarianresponse-info/31056/4

magicznyleszek commented 2 years ago

TLDR: Data Table filters by name, not the label, but it displays labels, so you can end up with confusing results.

magicznyleszek commented 2 years ago

Some reproduction steps:

  1. Use lotr.xlsx form
  2. Add few submissions selecting "The one ring"
  3. Add few submissions selecting "Isildur's bane"
  4. In Data Table, fitler the question by typing "one"
  5. I would expect to see all submissions with "The one ring" response, but I see all with "Isildur's bane" :bug:

This happens because "Isildur's bane" choice name is "one", and "The one ring" choice name is "four" (and filtering happens only by name, not label), see:

Screenshot 2022-09-14 at 23 03 35

Front-end is using asset data endpoint: /api/v2/assets/aJA8hWHcMErBfSKGsjqTqw/data/?limit=30&start=0&sort={"_id":-1}&query={"Pick_your_favourite_d_of_the_Rings_thing":{"$regex":"one","$options":"i"}}, so I'm not sure if this is fixable, unless back-end magicians do some magic.