fix: albums are now also contained in the child song collection album attributes

This commit is contained in:
Hazel 2024-04-12 14:33:33 +02:00
parent 29e2b4616e
commit 3aef267608
2 changed files with 5 additions and 2 deletions

View File

@ -58,7 +58,7 @@ class Collection(Generic[T]):
self._indexed_values[name].add(value)
self._indexed_to_objects[value].append(__object)
if not from_map:
if not from_map or True:
for attribute, new_object in self.contain_given_in_attribute.items():
__object.__getattribute__(attribute).contain_collection_inside(new_object)
@ -110,7 +110,7 @@ class Collection(Generic[T]):
if self._contained_in_self(__object):
return [self]
for collection in self.children:
for collection in (*self.children, *self.parents):
results.extend(collection._contained_in_sub(__object, break_at_first=break_at_first))
if break_at_first:

View File

@ -244,6 +244,9 @@ class Album(Base):
self.song_collection.contain_attribute_in_given = {
"main_artist_collection": self.artist_collection
}
self.song_collection.append_object_to_attribute = {
"album_collection": self
}
def _add_other_db_objects(self, object_type: Type[OuterProxy], object_list: List[OuterProxy]):
if object_type is Song: