Skip to content

Age range support

Martin Burchell requested to merge age-range-support into staging

I've kept the age field for now (it's hidden from the table and form) and added a new taxonomy for age ranges (I'd like to see us using this more in the future instead of adding new fields to the database). Internews want to filter by one age range OR another so I've extended the API to allow this.

I've changed the dropdown on the age range filter to be a multi-select, added the age range field to the item add/edit form and changed the importer to import age range as a taxonomy term.

I've assumed the age range column in the Kobo spreadsheet will be called "Age range". We can easily change this in the JSON blob. Also the age range terms are exactly as per Em's email but the format is inconsistent (some have yrs and some don't). We might have to change that too.

I notice that the spreadsheet import configuration is still in bangladesh-refugee-crisis.json. This will need to be moved into its own file so it can be shared across country contexts.

A couple of bugs that will need addressing soonish

  • If transport.terms.create fails on import due to a typo in an age range term, the error isn't handled correctly. I've documented the problem
  • I've xfailed one of my tests because the kobo tests load the fixtures JSON file, which create the age range terms. If the kobo tests are run along with the xfailed test, the results are different. We should probably only load the importer configuration for the kobo tests and create anything else needed in the tests themselves.

I've rushed this a bit to get it done today so there will probably be bugs.

Merge request reports