fix(search): correct radius units and distance display for postcode search
All checks were successful
Build and Push Docker Images / Build Backend (FastAPI) (push) Successful in 32s
Build and Push Docker Images / Build Frontend (Next.js) (push) Successful in 1m4s
Build and Push Docker Images / Trigger Portainer Update (push) Successful in 0s

FilterBar was sending radius in km (e.g. 1.6) but the backend expects miles,
causing the "Showing schools within X miles" banner to display the wrong value.
Change option values to miles (0.5, 1, 3, 5, 10) and default from 1.6 to 1.

school.distance from the API is already in miles (backend haversine uses
R=3959). SchoolRow was dividing by 1609.34 giving 0.0 mi; CompactSchoolItem
was dividing by 1.60934. Both now display school.distance directly.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-23 22:39:50 +00:00
parent 0f29397253
commit 6ddfcadbde
3 changed files with 10 additions and 10 deletions

View File

@@ -108,7 +108,7 @@ export function SchoolRow({
)}
{isLocationSearch && school.distance != null && (
<span className={styles.distanceBadge}>
{(school.distance / 1609.34).toFixed(1)} mi
{school.distance.toFixed(1)} mi
</span>
)}
</div>