Bug fix for empty albums

This commit is contained in:
Rhet Turnbull
2020-07-06 10:35:54 -07:00
parent a934b692ab
commit 1ef518cc3e
3 changed files with 19 additions and 8 deletions

View File

@@ -1,3 +1,3 @@
""" version info """
__version__ = "0.30.9"
__version__ = "0.30.10"

View File

@@ -48,13 +48,16 @@ class AlbumInfo:
try:
return self._photos
except AttributeError:
uuid, sort_order = zip(*self._db._dbalbums_album[self.uuid])
self._photos = self._db.photos(uuid=uuid)
# PhotosDB.photos does not preserve order when passing in list of uuids
# so need to build photo list one a time
# sort uuids by sort order
sorted_uuid = sorted(zip(sort_order, uuid))
self._photos = [self._db.photos(uuid=[uuid])[0] for _, uuid in sorted_uuid]
if self.uuid in self._db._dbalbums_album:
uuid, sort_order = zip(*self._db._dbalbums_album[self.uuid])
self._photos = self._db.photos(uuid=uuid)
# PhotosDB.photos does not preserve order when passing in list of uuids
# so need to build photo list one a time
# sort uuids by sort order
sorted_uuid = sorted(zip(sort_order, uuid))
self._photos = [self._db.photos(uuid=[uuid])[0] for _, uuid in sorted_uuid]
else:
self._photos = []
return self._photos
@property