From 5240bb2f71b04ba97d83a7f7ec3f888496a0cb58 Mon Sep 17 00:00:00 2001 From: Georges-Antoine Assi Date: Thu, 15 Jan 2026 13:15:29 -0500 Subject: [PATCH] more changes from bot review --- backend/endpoints/rom.py | 27 +++--------------------- backend/handler/database/roms_handler.py | 27 ++++++++++++++++-------- 2 files changed, 21 insertions(+), 33 deletions(-) diff --git a/backend/endpoints/rom.py b/backend/endpoints/rom.py index b99dc9438..79e2c93fb 100644 --- a/backend/endpoints/rom.py +++ b/backend/endpoints/rom.py @@ -481,24 +481,14 @@ def get_roms( filter_query = db_rom_handler.filter_roms( query=unfiltered_query, user_id=request.user.id, + platform_ids=platform_ids, collection_id=collection_id, virtual_collection_id=virtual_collection_id, smart_collection_id=smart_collection_id, search_term=search_term, ) query_filters = db_rom_handler.with_filter_values(query=filter_query) - filter_values = RomFiltersDict( - genres=query_filters["genres"], - franchises=query_filters["franchises"], - collections=query_filters["collections"], - companies=query_filters["companies"], - game_modes=query_filters["game_modes"], - age_ratings=query_filters["age_ratings"], - player_counts=query_filters["player_counts"], - regions=query_filters["regions"], - languages=query_filters["languages"], - platforms=query_filters["platforms"], - ) + filter_values = RomFiltersDict(**query_filters) # Get all ROM IDs in order for the additional data with sync_session.begin() as session: @@ -718,18 +708,7 @@ async def get_rom_filters(request: Request) -> RomFiltersDict: filters = db_rom_handler.get_rom_filters() - return RomFiltersDict( - genres=filters["genres"], - franchises=filters["franchises"], - collections=filters["collections"], - companies=filters["companies"], - game_modes=filters["game_modes"], - age_ratings=filters["age_ratings"], - player_counts=filters["player_counts"], - regions=filters["regions"], - languages=filters["languages"], - platforms=filters["platforms"], - ) + return RomFiltersDict(**filters) @protected_route( diff --git a/backend/handler/database/roms_handler.py b/backend/handler/database/roms_handler.py index 7bc1e9d02..2ab124b0f 100644 --- a/backend/handler/database/roms_handler.py +++ b/backend/handler/database/roms_handler.py @@ -1247,15 +1247,24 @@ class DBRomsHandler(DBBaseHandler): for row in session.execute(statement): g, f, cl, co, gm, ar, pc, rg, lg, pid = row - genres.update(g) - franchises.update(f) - collections.update(cl) - companies.update(co) - game_modes.update(gm) - age_ratings.update(ar) - player_counts.update(pc) - regions.update(rg) - languages.update(lg) + if g: + genres.update(g) + if f: + franchises.update(f) + if cl: + collections.update(cl) + if co: + companies.update(co) + if gm: + game_modes.update(gm) + if ar: + age_ratings.update(ar) + if pc: + player_counts.add(pc) + if rg: + regions.update(rg) + if lg: + languages.update(lg) platforms.add(pid) return {