feat(watchlist): exact match by default, * for a family
The prefix matching ported from DXHunter swallowed too much: a three-letter special-event entry N8W lit up NEEDED for N8WCR, a different station entirely. The implicit becomes explicit — a bare entry matches exactly that call, a trailing star makes it a family: VK9* catches every VK9…, RI0SP* the expedition's portable forms. A star anywhere else (or alone) is refused at Add rather than silently matching nothing. Same rule in the backend Match and the tab's own matcher, pinned by test.
This commit is contained in:
@@ -43,9 +43,16 @@ interface Props {
|
||||
// A spot is ON AIR for the badge while its last sighting is this fresh.
|
||||
const ON_AIR_MS = 10 * 60 * 1000;
|
||||
|
||||
// Exact unless the entry carries a trailing * — the same rule the backend's
|
||||
// Match applies to the live stream, mirrored so the tab and the alerts can
|
||||
// never disagree about what an entry covers.
|
||||
function matchesEntry(call: string, pattern: string): boolean {
|
||||
const c = call.toUpperCase();
|
||||
return c === pattern || c.startsWith(pattern);
|
||||
if (pattern.endsWith('*')) {
|
||||
const p = pattern.slice(0, -1);
|
||||
return p !== '' && c.startsWith(p);
|
||||
}
|
||||
return c === pattern;
|
||||
}
|
||||
|
||||
export function WatchlistTab({ spots, spotStatus, onSpotSelect, onSpotClick }: Props) {
|
||||
|
||||
Reference in New Issue
Block a user