1
0
mirror of https://github.com/KubaPro010/fm-dx-webserver.git synced 2026-02-26 22:13:53 +01:00

Multi TX search tweaks

Order the match list by score, clean up of matches panel HTML and show score in DOM as data element
This commit is contained in:
Adam Wisher
2025-05-31 09:12:26 +01:00
parent 64af7dbf16
commit c9fd4915b8
4 changed files with 16 additions and 11 deletions

View File

@@ -421,7 +421,8 @@ function handleData(wss, receivedData, rdsWss) {
id: currentTx.id,
pi: currentTx.pi,
reg: currentTx.reg,
otherMatches: currentTx.others
otherMatches: currentTx.others,
score: currentTx.score,
};
}
})

View File

@@ -191,10 +191,12 @@ async function fetchTx(freq, piCode, rdsPs) {
for (loc of filteredLocations) {
loc.score = evaluateStation(loc);
}
match = filteredLocations.reduce((max, obj) => obj.score > max.score ? obj : max, filteredLocations[0]);
multiMatches = filteredLocations.filter(obj => obj !== match);
filteredLocations.sort((a, b) => b.score - a.score);
match = filteredLocations[0];
multiMatches = filteredLocations.slice(1);
} else if (filteredLocations.length === 1) {
match = filteredLocations[0];
match.score = 1;
}
if (match) {
@@ -218,6 +220,7 @@ async function fetchTx(freq, piCode, rdsPs) {
pi: match.pi,
foundStation: true,
reg: match.detectedByPireg,
score: match.score,
others: multiMatches,
};
} else {