Fetching and then instantly reloading library loses data #256
@ -70,18 +70,18 @@ impl<Database, Library> IMusicHoardBasePrivate for MusicHoard<Database, Library>
|
||||
}
|
||||
|
||||
fn merge_collections<It: IntoIterator<Item = Artist>>(&self, database: It) -> Collection {
|
||||
let mut primary_map = NormalMap::<Artist>::new();
|
||||
let mut secondary_map = NormalMap::<Artist>::new();
|
||||
let mut primary = NormalMap::<Artist>::new();
|
||||
let mut secondary = NormalMap::<Artist>::new();
|
||||
|
||||
for artist in self.library_cache.iter().cloned() {
|
||||
primary_map.insert(string::normalize_string(&artist.meta.id.name), artist);
|
||||
primary.insert(string::normalize_string(&artist.meta.id.name), artist);
|
||||
}
|
||||
|
||||
for artist in database.into_iter() {
|
||||
secondary_map.insert(string::normalize_string(&artist.meta.id.name), artist);
|
||||
secondary.insert(string::normalize_string(&artist.meta.id.name), artist);
|
||||
}
|
||||
|
||||
let mut collection = MergeCollections::merge_by_name(primary_map, secondary_map);
|
||||
let mut collection = MergeCollections::merge_by_name(primary, secondary);
|
||||
collection.sort_unstable();
|
||||
|
||||
collection
|
||||
|
Loading…
x
Reference in New Issue
Block a user