Fetch loses albums with CannotHaveMbid as mb_ref #259

Merged
wojtek merged 3 commits from 255---fetch-loses-albums-with-cannothavembid-as-mb_ref into main 2025-01-05 14:55:36 +01:00
Showing only changes of commit 6919f0214a - Show all commits

View File

@ -212,6 +212,10 @@ impl AppMachine<MatchState> {
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<MatchState> {
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())
}