fix spot filtering

pull/27/head
accius 3 days ago
parent 9fadca17be
commit c60c318c00

@ -993,15 +993,13 @@
return { cqZone: null, ituZone: null, continent: null }; return { cqZone: null, ituZone: null, continent: null };
}; };
// Filter DX paths based on filters (same logic as spot filtering) // Filter DX paths based on filters (filter by SPOTTER origin)
const filterDXPaths = (paths, filters) => { const filterDXPaths = (paths, filters) => {
if (!paths || !filters) return paths; if (!paths || !filters) return paths;
if (Object.keys(filters).length === 0) return paths; if (Object.keys(filters).length === 0) return paths;
return paths.filter(path => { return paths.filter(path => {
// Get info for DX call (the target station) // Get info for spotter (origin) - this is what we filter by
const dxCallInfo = getCallsignInfo(path.dxCall);
// Get info for spotter (origin)
const spotterInfo = getCallsignInfo(path.spotter); const spotterInfo = getCallsignInfo(path.spotter);
// Watchlist filter - show ONLY watchlist if enabled // Watchlist filter - show ONLY watchlist if enabled
@ -1022,23 +1020,23 @@
if (isExcluded) return false; if (isExcluded) return false;
} }
// CQ Zone filter (applies to DX station) // CQ Zone filter - filter by SPOTTER's zone (origin)
if (filters.cqZones?.length > 0) { if (filters.cqZones?.length > 0) {
if (!dxCallInfo.cqZone || !filters.cqZones.includes(dxCallInfo.cqZone)) { if (!spotterInfo.cqZone || !filters.cqZones.includes(spotterInfo.cqZone)) {
return false; return false;
} }
} }
// ITU Zone filter (applies to DX station) // ITU Zone filter - filter by SPOTTER's zone (origin)
if (filters.ituZones?.length > 0) { if (filters.ituZones?.length > 0) {
if (!dxCallInfo.ituZone || !filters.ituZones.includes(dxCallInfo.ituZone)) { if (!spotterInfo.ituZone || !filters.ituZones.includes(spotterInfo.ituZone)) {
return false; return false;
} }
} }
// Continent filter (applies to DX station) // Continent filter - filter by SPOTTER's continent (origin)
if (filters.continents?.length > 0) { if (filters.continents?.length > 0) {
if (!dxCallInfo.continent || !filters.continents.includes(dxCallInfo.continent)) { if (!spotterInfo.continent || !filters.continents.includes(spotterInfo.continent)) {
return false; return false;
} }
} }
@ -1081,7 +1079,8 @@
if (!filters || Object.keys(filters).length === 0) return spots; if (!filters || Object.keys(filters).length === 0) return spots;
return spots.filter(spot => { return spots.filter(spot => {
const callInfo = getCallsignInfo(spot.call); // Get spotter info for origin-based filtering
const spotterInfo = getCallsignInfo(spot.spotter);
// Watchlist only mode - must match watchlist // Watchlist only mode - must match watchlist
if (filters.watchlistOnly && filters.watchlist?.length > 0) { if (filters.watchlistOnly && filters.watchlist?.length > 0) {
@ -1101,19 +1100,19 @@
if (isExcluded) return false; if (isExcluded) return false;
} }
// CQ Zone filter // CQ Zone filter - filter by SPOTTER's zone (origin)
if (filters.cqZones?.length > 0) { if (filters.cqZones?.length > 0) {
if (!callInfo.cqZone || !filters.cqZones.includes(callInfo.cqZone)) return false; if (!spotterInfo.cqZone || !filters.cqZones.includes(spotterInfo.cqZone)) return false;
} }
// ITU Zone filter // ITU Zone filter - filter by SPOTTER's zone (origin)
if (filters.ituZones?.length > 0) { if (filters.ituZones?.length > 0) {
if (!callInfo.ituZone || !filters.ituZones.includes(callInfo.ituZone)) return false; if (!spotterInfo.ituZone || !filters.ituZones.includes(spotterInfo.ituZone)) return false;
} }
// Continent filter // Continent filter - filter by SPOTTER's continent (origin)
if (filters.continents?.length > 0) { if (filters.continents?.length > 0) {
if (!callInfo.continent || !filters.continents.includes(callInfo.continent)) return false; if (!spotterInfo.continent || !filters.continents.includes(spotterInfo.continent)) return false;
} }
// Band filter // Band filter

Loading…
Cancel
Save

Powered by TurnKey Linux.