From 6a77f3a100c88bb87c9e165155eee60d5c11e14c Mon Sep 17 00:00:00 2001 From: zurdi Date: Thu, 12 Jun 2025 12:05:16 +0000 Subject: [PATCH] fix: initialize missing status for platforms and update rom missing status handling --- backend/endpoints/platform.py | 1 + backend/endpoints/sockets/scan.py | 20 +++++++------------- 2 files changed, 8 insertions(+), 13 deletions(-) diff --git a/backend/endpoints/platform.py b/backend/endpoints/platform.py index 154805a8a..82b8fcf52 100644 --- a/backend/endpoints/platform.py +++ b/backend/endpoints/platform.py @@ -90,6 +90,7 @@ def get_supported_platforms(request: Request) -> list[PlatformSchema]: "created_at": now, "updated_at": now, "fs_size_bytes": 0, + "missing": False, } if platform["name"] in db_platforms_map: diff --git a/backend/endpoints/sockets/scan.py b/backend/endpoints/sockets/scan.py index f60674c86..02345cf41 100644 --- a/backend/endpoints/sockets/scan.py +++ b/backend/endpoints/sockets/scan.py @@ -227,18 +227,14 @@ async def _identify_rom( return scan_stats if not _should_scan_rom(scan_type=scan_type, rom=rom, roms_ids=roms_ids): - log.debug( - f"Skipping {hl(fs_rom['fs_name'], color=BLUE)} for scan type {scan_type.name}" - ) - if rom and rom.fs_name != fs_rom["fs_name"]: - # Just to update the filesystem data - rom.fs_name = fs_rom["fs_name"] - rom.missing = False - db_rom_handler.add_rom(rom) + if rom: + if rom.fs_name != fs_rom["fs_name"]: + # Just to update the filesystem data + rom.fs_name = fs_rom["fs_name"] + db_rom_handler.add_rom(rom) - elif rom and rom.missing: - rom.missing = False - db_rom_handler.add_rom(rom) + if rom.missing: + db_rom_handler.update_rom(rom.id, {"missing": False}) return scan_stats @@ -446,8 +442,6 @@ async def _identify_platform( fs_names={fs_rom["fs_name"] for fs_rom in fs_roms_batch}, ) - log.debug(rom_by_filename_map) - for fs_rom in fs_roms_batch: scan_stats += await _identify_rom( platform=platform,