From 6919f0214a9d456315b25fb40a3e5a1697498740 Mon Sep 17 00:00:00 2001 From: Wojciech Kozlowski Date: Sun, 5 Jan 2025 13:31:32 +0100 Subject: [PATCH] Code fix --- src/tui/app/machine/match_state.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/tui/app/machine/match_state.rs b/src/tui/app/machine/match_state.rs index 7c2f202..a66867a 100644 --- a/src/tui/app/machine/match_state.rs +++ b/src/tui/app/machine/match_state.rs @@ -212,6 +212,10 @@ impl AppMachine { mh.set_artist_mb_ref(&matches.matching.id, tuple.mb_ref) } + fn filter_mb_ref(left: &AlbumMbRef, right: &AlbumMbRef) -> bool { + (left == right) && !matches!(left, AlbumMbRef::CannotHaveMbid) + } + fn select_album( inner: &mut AppInner, matches: &AlbumMatches, @@ -225,7 +229,7 @@ impl AppMachine { let iter = artist.albums.iter(); let filtered = iter .filter(|album| album.meta.id != matches.matching) - .filter(|album| album.meta.id.mb_ref == tuple.mb_ref); + .filter(|album| Self::filter_mb_ref(&album.meta.id.mb_ref, &tuple.mb_ref)); clashing.extend(filtered.map(|a| &a.meta.id).cloned()) }