mirror of
https://github.com/rommapp/romm.git
synced 2026-11-28 17:48:31 +01:00
Sorting GET /api/roms by a per-user column (last_played, rating, status, ...) re-applied the RomUser user filter as a WHERE clause, collapsing the user-scoped LEFT JOIN into an inner join: every rom the user had never touched vanished from the results and from the reported total. Drop the redundant filter (the join's ON clause already scopes the rows) and pin NULL sort keys last in both directions with a leading IS NULL term, which MariaDB, MySQL, and PostgreSQL all support. The char-index letter walk mirrors the same NULL bucket through a shared predicate so alpha-strip offsets stay aligned, and enum letter sources are cast to String so PostgreSQL can take substring() of them. Fixes #4100 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01ND1wfNV3vKwu8Mfinn4WkA