Files
romm/backend/tests/handler/database
Sam Dornan 5c43a97687 feat(gallery): pick a game's default version by region priority
The group_by_meta_id dedup window ordered each sibling group by
is_main_sibling then fs_name_no_ext, so absent a manual override the
gallery entry went to whichever filename sorted first: "(Demo)" beat
"(Europe)" beat "(USA)".

Two ordering terms now sit between those: a full release outranks a
pre-release, then the configured scan.priority.region order decides.
Release status comes first because a demo is not a substitute for the
game, so a Japanese release wins over a USA demo.

scan.priority.region already existed but only steered metadata and
artwork selection, so its description is reworded across all locales.

Regions live in a JSON column that no covering index can carry, and 0107
measured what one uncovered reference costs this window: the plan drops
from `type=index, Using index` to `type=ALL, key=NULL`, four times per
gallery page load. 0108 adds a STORED generated column over regions[0]
and covers it in idx_roms_sibling_cover instead, so the ranking reads a
scalar. The engine keeps it in sync and ALTER TABLE populates existing
rows, so no scan hook and no backfill are needed.

Pre-release detection matches the filename rather than the parsed `tags`
column: tags keep the dumper's casing, and fs_name_no_ext is already in
the index.

Reordering the priority list changes which rom represents a group, so the
cached gallery sidecars are dropped when the setting changes.

Closes #1528

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-21 11:55:07 -05:00
..
2025-10-23 11:12:17 -04:00
2026-08-01 14:49:58 -04:00
2025-10-23 11:12:17 -04:00