diff --git a/docs/superpowers/specs/2026-10-02-school-type-groups-and-faith-filter-design.md b/docs/superpowers/specs/2026-10-02-school-type-groups-and-faith-filter-design.md index 89e095b..eb40cf4 100644 --- a/docs/superpowers/specs/2026-10-02-school-type-groups-and-faith-filter-design.md +++ b/docs/superpowers/specs/2026-10-02-school-type-groups-and-faith-filter-design.md @@ -131,13 +131,20 @@ names. The names come from the same dictionaries, so the lookup is exact. ### `/api/schools` -- `school_type`: if the value is a type group key, filter on - `school_type_group`. Otherwise filter on the raw label exactly as today, so - an old `?school_type=Community+school` link keeps working. -- `faith` (new, optional, `max_length=40`, sanitised like the others): filter to - rows whose `faith_groups` contains the key. An unknown key returns no - schools rather than being ignored, so a typo does not silently show - everything. +Both filters work on the name columns at request time. `_names_in_group` +collects the distinct `school_type` or `religious_denomination` names the +group accepts, once per distinct name rather than per row, and the rows are +kept with `isin`. No group column is stored. + +- `school_type`: if the value is a type group key (any case), keep the rows + whose `school_type` name `type_group_for` puts in that group. Otherwise + filter on the raw label exactly as today, so an old + `?school_type=Community+school` link keeps working. +- `faith` (new, optional, `max_length=40`, sanitised like the others): keep the + rows whose `religious_denomination` name `faith_groups_for` puts in that + faith (any case); for `none`, rows with a missing name too. An unknown key + returns no schools rather than being ignored, so a typo does not silently + show everything. ### `/api/filters` diff --git a/nextjs-app/__tests__/components/FilterBarTypeFaith.test.tsx b/nextjs-app/__tests__/components/FilterBarTypeFaith.test.tsx index 0a82705..12e2a15 100644 --- a/nextjs-app/__tests__/components/FilterBarTypeFaith.test.tsx +++ b/nextjs-app/__tests__/components/FilterBarTypeFaith.test.tsx @@ -135,4 +135,3 @@ describe('a URL value the options do not spell the same way', () => { expect(screen.getByRole('combobox', { name: 'Faith' })).toHaveValue('roman_catholic'); }); }); - diff --git a/nextjs-app/__tests__/components/ResultsToolbar.test.tsx b/nextjs-app/__tests__/components/ResultsToolbar.test.tsx index 5a9b92e..a4d62b6 100644 --- a/nextjs-app/__tests__/components/ResultsToolbar.test.tsx +++ b/nextjs-app/__tests__/components/ResultsToolbar.test.tsx @@ -176,4 +176,3 @@ describe('the results list filter chips', () => { expect(chips).not.toHaveTextContent(/\bcouncil\b(?!-run)/); }); }); -