fix(search): default to half a mile, and offer a quarter mile #165

Merged
tudor merged 2 commits from fix/default-radius-half-mile into main 2026-10-01 17:49:12 +00:00
Owner

Changes the default search distance from 1 mile to 0.5 miles, and adds a 0.25-mile option.

  • Typing a postcode, and the near-me button, now search within 0.5 miles.
  • A postcode URL with no radius now uses 0.5 miles. Before, the Distance control showed "1 mile" while the API applied its own 5-mile default; the page and the map fetch now send the same default the control shows (DEFAULT_RADIUS_MILES in lib/utils.ts).
  • The Distance control offers 0.25 / 0.5 / 1 / 3 / 5 miles. A distance the user picked is kept as before. The API default stays at 5 miles; its 0.1-mile minimum already allows 0.25.
  • The radius in the results heading and the map circle was rounded to one decimal place, so 0.25 would have shown and been drawn as 0.3. It now keeps two decimal places, and the list heading reads "within 1 mile of …" instead of "within 1.0 miles of …".

Tests

  • FilterBarRadius.test.tsx: postcode submit uses radius=0.5; a URL with no radius shows 0.5; a chosen radius is kept; the options include 0.25 but default to 0.5.
  • ResultsMapView.test.tsx: a quarter-mile search is drawn and labelled as 0.25 in both map and list headings; the list-heading expectation is updated to "1 mile".
  • The E2E journey "searching by postcode returns nearby schools" now asserts radius=0.5 and the Distance value. It runs against staging after merge.
  • tsc clean, jest 524/524.

🤖 Generated with Claude Code

Changes the default search distance from 1 mile to **0.5 miles**, and adds a **0.25-mile** option. - Typing a postcode, and the near-me button, now search within 0.5 miles. - A postcode URL with no `radius` now uses 0.5 miles. Before, the Distance control showed "1 mile" while the API applied its own 5-mile default; the page and the map fetch now send the same default the control shows (`DEFAULT_RADIUS_MILES` in `lib/utils.ts`). - The Distance control offers 0.25 / 0.5 / 1 / 3 / 5 miles. A distance the user picked is kept as before. The API default stays at 5 miles; its 0.1-mile minimum already allows 0.25. - The radius in the results heading and the map circle was rounded to one decimal place, so 0.25 would have shown and been drawn as 0.3. It now keeps two decimal places, and the list heading reads "within 1 mile of …" instead of "within 1.0 miles of …". **Tests** - `FilterBarRadius.test.tsx`: postcode submit uses `radius=0.5`; a URL with no radius shows 0.5; a chosen radius is kept; the options include 0.25 but default to 0.5. - `ResultsMapView.test.tsx`: a quarter-mile search is drawn and labelled as 0.25 in both map and list headings; the list-heading expectation is updated to "1 mile". - The E2E journey "searching by postcode returns nearby schools" now asserts `radius=0.5` and the Distance value. It runs against staging after merge. - `tsc` clean, jest 524/524. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
tudor added 1 commit 2026-10-01 16:40:53 +00:00
fix(search): start postcode searches at half a mile
PR Checks / Frontend Typecheck + Tests (pull_request) Successful in 1m12s
PR Checks / Backend Smoke (pull_request) Successful in 10s
PR Checks / Build Backend (no push) (pull_request) Successful in 21s
PR Checks / Build Frontend (no push) (pull_request) Successful in 1m19s
PR Checks / Build Pipeline (no push) (pull_request) Successful in 11s
PR Checks / AI Code Review (Claude) (pull_request) Successful in 16s
96deab7d58
New postcode searches, the near-me button and URLs without a radius now
use 0.5 miles. A postcode URL with no radius used to show "1 mile" in the
Distance control while the API applied its own 5-mile default; the page
and the map fetch now send the same default the control displays.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

🤖 AI Code Review (Claude Code)

This change introduces a shared DEFAULT_RADIUS_MILES constant (0.5) and uses it in the server page, the FilterBar, the near-me redirect and the map fetch. A new postcode search now starts at half a mile in both the UI and the API request. Unit and e2e tests cover the new default. The change looks consistent and low risk.

🟡 Minor

  • nextjs-app/app/(frontend)/page.tsx: The default radius is now sent to the API on every request, including ones with no postcode (for example the plain home page). This is harmless if the API ignores radius without a postcode, but it is worth confirming. It could be applied only when a postcode is present, which would also keep cache keys and URLs for non-location queries unchanged. The same applies to params.radius ??= DEFAULT_RADIUS_MILES in HomeView's map fetch.
## 🤖 AI Code Review (Claude Code) This change introduces a shared DEFAULT_RADIUS_MILES constant (0.5) and uses it in the server page, the FilterBar, the near-me redirect and the map fetch. A new postcode search now starts at half a mile in both the UI and the API request. Unit and e2e tests cover the new default. The change looks consistent and low risk. ### 🟡 Minor - **nextjs-app/app/(frontend)/page.tsx**: The default radius is now sent to the API on every request, including ones with no postcode (for example the plain home page). This is harmless if the API ignores radius without a postcode, but it is worth confirming. It could be applied only when a postcode is present, which would also keep cache keys and URLs for non-location queries unchanged. The same applies to `params.radius ??= DEFAULT_RADIUS_MILES` in HomeView's map fetch.
tudor added 1 commit 2026-10-01 16:52:59 +00:00
feat(search): offer a quarter-mile distance
PR Checks / Frontend Typecheck + Tests (pull_request) Successful in 1m12s
PR Checks / Backend Smoke (pull_request) Successful in 10s
PR Checks / Build Backend (no push) (pull_request) Successful in 18s
PR Checks / Build Frontend (no push) (pull_request) Successful in 1m19s
PR Checks / Build Pipeline (no push) (pull_request) Successful in 11s
PR Checks / AI Code Review (Claude) (pull_request) Successful in 17s
355a5a841c
Adds "Within 0.25 miles" to the Distance control; 0.5 stays the default.
The radius shown in the results heading and drawn on the map was rounded
to one decimal place, which would have turned 0.25 into 0.3. It now keeps
two, and the list heading says "1 mile" rather than "1.0 miles".

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
tudor changed title from fix(search): start postcode searches at half a mile to fix(search): default to half a mile, and offer a quarter mile 2026-10-01 16:53:09 +00:00

🤖 AI Code Review (Claude Code)

Changes the default postcode-search radius to 0.5 miles through a shared DEFAULT_RADIUS_MILES constant. It applies the constant in the server page, FilterBar, HomeView's map fetch and the Near Me button. It also adds a 0.25-mile option and renders radius labels at two decimals, with unit and e2e tests. The change is consistent and looks healthy.

🟡 Minor

  • nextjs-app/app/(frontend)/page.tsx: The radius now defaults to 0.5 for every request, including ones with no postcode. This is harmless if the API ignores radius without a postcode. Any existing links with ?postcode= and no radius, which previously got the API's 5-mile default, will now search 0.5 miles. This is a deliberate but user-visible behaviour change. Consider sending the default only when a postcode is present.
## 🤖 AI Code Review (Claude Code) Changes the default postcode-search radius to 0.5 miles through a shared DEFAULT_RADIUS_MILES constant. It applies the constant in the server page, FilterBar, HomeView's map fetch and the Near Me button. It also adds a 0.25-mile option and renders radius labels at two decimals, with unit and e2e tests. The change is consistent and looks healthy. ### 🟡 Minor - **nextjs-app/app/(frontend)/page.tsx**: The radius now defaults to 0.5 for every request, including ones with no postcode. This is harmless if the API ignores radius without a postcode. Any existing links with `?postcode=` and no radius, which previously got the API's 5-mile default, will now search 0.5 miles. This is a deliberate but user-visible behaviour change. Consider sending the default only when a postcode is present.
tudor merged commit e2fc7a8f15 into main 2026-10-01 17:49:12 +00:00
Sign in to join this conversation.
No Reviewers
No labels
2 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: tudor/school_compare#165