You've already forked fm-dx-webserver
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:
@@ -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,
|
||||
};
|
||||
}
|
||||
})
|
||||
|
||||
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user