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

Cached database tidy up

Tidy up changes to just include the cached db functionality and TX ID algo 3 addition ready for pull
This commit is contained in:
Adam Wisher
2025-05-15 09:08:24 +01:00
parent 65fc84ff9f
commit f818262eff
5 changed files with 7 additions and 9 deletions

View File

@@ -149,10 +149,10 @@ function evaluateStation(station) {
return score;
}
// Fetch data from maps
// Fetch data from cached database
async function fetchTx(freq, piCode, rdsPs) {
let match = null;
let multiMatches = [];
// let multiMatches = [];
const now = Date.now();
freq = parseFloat(freq);
@@ -192,7 +192,7 @@ async function fetchTx(freq, piCode, rdsPs) {
loc.score = evaluateStation(loc);
}
match = filteredLocations.reduce((max, obj) => obj.score > max.score ? obj : max, filteredLocations[0]);
multiMatches = filteredLocations.filter(obj => obj !== match);
// multiMatches = filteredLocations.filter(obj => obj !== match);
} else if (filteredLocations.length === 1) {
match = filteredLocations[0];
}
@@ -218,7 +218,7 @@ async function fetchTx(freq, piCode, rdsPs) {
pi: match.pi,
foundStation: true,
reg: match.detectedByPireg,
others: multiMatches.length,
// others: multiMatches,
};
} else {
return Promise.resolve();