From d6c4eb9d56bb7e66f5d643a2fd1776c31827ef68 Mon Sep 17 00:00:00 2001 From: Sainan <63328889+Sainan@users.noreply.github.com> Date: Sat, 26 Apr 2025 21:38:56 +0200 Subject: [PATCH] chore: improve unlockAllScans's handling of existing scans --- src/controllers/stats/viewController.ts | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/controllers/stats/viewController.ts b/src/controllers/stats/viewController.ts index 55fbbb7f..3ff5a848 100644 --- a/src/controllers/stats/viewController.ts +++ b/src/controllers/stats/viewController.ts @@ -27,7 +27,15 @@ const viewController: RequestHandler = async (req, res) => { for (const type of Object.keys(ExportEnemies.avatars)) { 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) { responseJson.Scans.push({ type: type, scans: 9999 }); }