Small fixes

This commit is contained in:
Andras Schmelczer 2026-06-14 14:52:44 +01:00
parent 54fbcb1ea6
commit 083f8a982e
24 changed files with 1505 additions and 79 deletions

View file

@ -100,9 +100,10 @@ export function getSpecificCrimeFilterMeta(features: FeatureMeta[]): FeatureMeta
step: 1,
description:
'Violence, burglary, robbery, drugs, shoplifting, vehicle crime, anti-social behaviour, public order, theft, and other crime types',
detail: 'Filter by one street-level crime category at a time using yearly averages per LSOA.',
detail:
'Filter by one street-level crime category at a time using an area-normalised crime density near each postcode (not a count of incidents per year).',
source: 'crime',
suffix: '/yr',
suffix: '',
};
}

View file

@ -42,10 +42,12 @@ export function dedupeTravelTimeEntries(entries: TravelTimeEntry[]): TravelTimeE
label: existing.label || entry.label,
timeRange: mergeTimeRanges(existing.timeRange, entry.timeRange),
useBest: existing.useBest || entry.useBest,
// noChange/noBuses are part of the dedupe key, so for two entries to
// collide here they must already have matching flags. Carry them through
// explicitly so unset (undefined) doesn't clobber set (false/true).
// noChange/oneChange/noBuses are part of the dedupe key, so for two
// entries to collide here they must already have matching flags. Carry
// them through explicitly so unset (undefined) doesn't clobber set
// (false/true).
noChange: existing.noChange ?? entry.noChange,
oneChange: existing.oneChange ?? entry.oneChange,
noBuses: existing.noBuses ?? entry.noBuses,
};
}

View file

@ -49,6 +49,7 @@ describe('url-state', () => {
timeRange: [0, 30],
useBest: true,
noChange: false,
oneChange: false,
noBuses: false,
},
]);
@ -118,6 +119,7 @@ describe('url-state', () => {
timeRange: [10, 45],
useBest: false,
noChange: false,
oneChange: false,
noBuses: false,
},
]);

View file

@ -304,9 +304,9 @@ export function parseUrlState(): UrlState {
// Travel time: repeated `tt` params
// Format: serverMode:slug:label[:b][:min:max]
// serverMode is one of: car | bicycle | walking | transit | transit-no-bus
// | transit-no-change | transit-no-change-no-bus. transit-one-change[-no-bus]
// variants are server-side only and will cause the entry to be dropped here
// (parseServerMode returns null) so we don't silently broaden the user's filter.
// | transit-no-change | transit-no-change-no-bus | transit-one-change
// | transit-one-change-no-bus. Unknown modes cause the entry to be dropped
// here (parseServerMode returns null) so we don't silently broaden the filter.
const ttParams = params.getAll('tt');
if (ttParams.length > 0) {
const entries: TravelTimeEntry[] = [];
@ -337,6 +337,7 @@ export function parseUrlState(): UrlState {
timeRange,
useBest,
noChange: parsedMode.noChange,
oneChange: parsedMode.oneChange,
noBuses: parsedMode.noBuses,
});
}