chore: optimise unlockAllScans

~20ms to ~6ms
This commit is contained in:
Sainan 2025-01-18 16:38:38 +01:00
parent 9f21696dcf
commit d56b2cf8ad
2 changed files with 1097 additions and 4363 deletions

View File

@ -23,12 +23,16 @@ const viewController: RequestHandler = async (req, res) => {
}); });
} }
if (config.unlockAllScans) { if (config.unlockAllScans) {
responseJson.Scans = allScans; const scans = new Set(allScans);
for (const type of Object.keys(ExportEnemies.avatars)) { for (const type of Object.keys(ExportEnemies.avatars)) {
if (!responseJson.Scans.find(x => x.type == type)) { if (!scans.has(type)) {
responseJson.Scans.push({ type, scans: 9999 }); scans.add(type);
} }
} }
responseJson.Scans = [];
for (const type of scans) {
responseJson.Scans.push({ type: type, scans: 9999 });
}
} }
res.json(responseJson); res.json(responseJson);
}; };

File diff suppressed because it is too large Load Diff