app.show_collection: rewrite if small collection part to using one if

master
Felix Stupp 7 months ago
parent f311c53c9f
commit 5b94844b87
Signed by: zocker
GPG Key ID: 93E1BD26F6B02FB7

@ -440,18 +440,15 @@ def show_collection(collection_id: int) -> ResponseReturnValue:
collection: MediaCollection = MediaCollection.get(id=collection_id)
if collection is None:
return make_response(f"Not found", 404)
media_links = (
MediaCollectionLink.sorted(
media_links = None
media_titles = None
if orm.count(collection.media_links) <= SMALL_COLLECTION_MAX_COUNT:
media_links = MediaCollectionLink.sorted(
MediaCollectionLink.select(lambda l: l.collection == collection)
)
if orm.count(collection.media_links) <= SMALL_COLLECTION_MAX_COUNT
else None
)
media_titles = (
remove_common_trails([link.element.title for link in media_links])
if media_links is not None
else None
)
media_titles = remove_common_trails(
[link.element.title for link in media_links]
)
return render_template(
"collection_element.htm",
collection=collection,

Loading…
Cancel
Save