From 680943eff5bff394e0c4a1523dde263ed9047c67 Mon Sep 17 00:00:00 2001 From: Michael Manganiello Date: Fri, 6 Sep 2024 09:11:25 -0300 Subject: [PATCH 1/2] fix: Use filename without tags or extension when matching unmatched game If a game is manually unmatched, we update its `name` field to `file_name` (which includes both tags and extension). After that, if we go to the Rom list, and click on "Manual match" for that rom, the search field is populated with that Rom name, which commonly won't retrieve any results from the metadata providers. This change makes the "Manual match" search term to use the filename without tags or extension, when the Rom is currently not matched. It also triggers the search automatically when a search term was set. Potential fix for #1167. --- frontend/src/components/common/Game/Dialog/MatchRom.vue | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/frontend/src/components/common/Game/Dialog/MatchRom.vue b/frontend/src/components/common/Game/Dialog/MatchRom.vue index dab1b4da6..3282777eb 100644 --- a/frontend/src/components/common/Game/Dialog/MatchRom.vue +++ b/frontend/src/components/common/Game/Dialog/MatchRom.vue @@ -39,9 +39,14 @@ const isIGDBFiltered = ref(true); const isMobyFiltered = ref(true); emitter?.on("showMatchRomDialog", (romToSearch) => { rom.value = romToSearch; - searchTerm.value = romToSearch.name || romToSearch.file_name_no_tags || ""; + // Use rom name as search term, only when it's matched; otherwise use the filename without tags + // and extension. + searchTerm.value = + romToSearch.igdb_id || romToSearch.moby_id + ? romToSearch.name || "" + : romToSearch.file_name_no_tags || ""; show.value = true; - if (rom.value.igdb_id || rom.value.moby_id) { + if (searchTerm.value) { searchRom(); } }); From d2d9f1df080b3c62eb8f06925be6f28e8f920022 Mon Sep 17 00:00:00 2001 From: Georges-Antoine Assi Date: Fri, 6 Sep 2024 09:12:49 -0400 Subject: [PATCH 2/2] small code styling --- .../src/components/common/Game/Dialog/MatchRom.vue | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/frontend/src/components/common/Game/Dialog/MatchRom.vue b/frontend/src/components/common/Game/Dialog/MatchRom.vue index 3282777eb..101ada6ad 100644 --- a/frontend/src/components/common/Game/Dialog/MatchRom.vue +++ b/frontend/src/components/common/Game/Dialog/MatchRom.vue @@ -39,13 +39,15 @@ const isIGDBFiltered = ref(true); const isMobyFiltered = ref(true); emitter?.on("showMatchRomDialog", (romToSearch) => { rom.value = romToSearch; - // Use rom name as search term, only when it's matched; otherwise use the filename without tags - // and extension. + show.value = true; + + // Use name as search term, only when it's matched + // Otherwise use the filename without tags and extensions searchTerm.value = romToSearch.igdb_id || romToSearch.moby_id - ? romToSearch.name || "" - : romToSearch.file_name_no_tags || ""; - show.value = true; + ? (romToSearch.name ?? "") + : romToSearch.file_name_no_tags; + if (searchTerm.value) { searchRom(); }