chore: improve unlockAllScans's handling of existing scans
All checks were successful
Build / build (push) Successful in 56s
Build / build (pull_request) Successful in 1m32s

This commit is contained in:
Sainan 2025-04-26 21:38:56 +02:00
parent de36e2ee8d
commit d6c4eb9d56

View File

@ -27,7 +27,15 @@ const viewController: RequestHandler = async (req, res) => {
for (const type of Object.keys(ExportEnemies.avatars)) { for (const type of Object.keys(ExportEnemies.avatars)) {
if (!scans.has(type)) scans.add(type); if (!scans.has(type)) scans.add(type);
} }
responseJson.Scans ??= [];
// Take any existing scans and also set them to 9999
if (responseJson.Scans) {
for (const scan of responseJson.Scans) {
scans.add(scan.type);
}
}
responseJson.Scans = [];
for (const type of scans) { for (const type of scans) {
responseJson.Scans.push({ type: type, scans: 9999 }); responseJson.Scans.push({ type: type, scans: 9999 });
} }