fix: push to
This commit is contained in:
parent
312e26ec44
commit
796f609d86
@ -82,9 +82,9 @@ class Collection(Generic[T]):
|
|||||||
|
|
||||||
def _find_object(self, __object: T) -> Optional[T]:
|
def _find_object(self, __object: T) -> Optional[T]:
|
||||||
for c in self.push_to:
|
for c in self.push_to:
|
||||||
found = c._find_object(__object)
|
found, found_in = c._find_object(__object)
|
||||||
if found is not None:
|
if found is not None:
|
||||||
return found, c
|
return found, found_in
|
||||||
|
|
||||||
self._remap()
|
self._remap()
|
||||||
|
|
||||||
@ -92,6 +92,8 @@ class Collection(Generic[T]):
|
|||||||
if value in self._indexed_values[name]:
|
if value in self._indexed_values[name]:
|
||||||
return self._indexed_values[name][value], self
|
return self._indexed_values[name][value], self
|
||||||
|
|
||||||
|
return None, self
|
||||||
|
|
||||||
def append(self, __object: Optional[T], **kwargs):
|
def append(self, __object: Optional[T], **kwargs):
|
||||||
"""
|
"""
|
||||||
If an object, that represents the same entity exists in a relevant collection,
|
If an object, that represents the same entity exists in a relevant collection,
|
||||||
|
@ -56,14 +56,7 @@ def music_responsive_list_item_renderer(renderer: dict) -> List[DatabaseObject]:
|
|||||||
|
|
||||||
for song in song_list:
|
for song in song_list:
|
||||||
song.album_collection.extend(album_list)
|
song.album_collection.extend(album_list)
|
||||||
|
song.feature_artist_collection.extend(artist_list)
|
||||||
for artist in artist_list:
|
|
||||||
existing_artist = song.main_artist_collection._find_object(artist)
|
|
||||||
|
|
||||||
if existing_artist is None:
|
|
||||||
song.feature_artist_collection.append(artist)
|
|
||||||
else:
|
|
||||||
existing_artist.merge(artist)
|
|
||||||
|
|
||||||
if len(song_list) > 0:
|
if len(song_list) > 0:
|
||||||
return song_list
|
return song_list
|
||||||
|
Loading…
Reference in New Issue
Block a user