From c966a6de07558d33d79a48aeadd877fc673efc26 Mon Sep 17 00:00:00 2001 From: profitroll Date: Mon, 14 Aug 2023 13:55:49 +0200 Subject: [PATCH] Fixed direction errors --- extensions/photos.py | 2 +- extensions/videos.py | 32 ++++++++++++-------------------- 2 files changed, 13 insertions(+), 21 deletions(-) diff --git a/extensions/photos.py b/extensions/photos.py index 3015bf4..c90e28f 100644 --- a/extensions/photos.py +++ b/extensions/photos.py @@ -621,7 +621,7 @@ async def photo_find( } async for image in col_photos.find(db_query, limit=page_size, skip=skip).sort( - "dates.uploaded", DESCENDING + "dates.uploaded", direction=DESCENDING ): output["results"].append( { diff --git a/extensions/videos.py b/extensions/videos.py index 031dcb9..671bcb8 100644 --- a/extensions/videos.py +++ b/extensions/videos.py @@ -393,31 +393,23 @@ async def video_find( "caption": re.compile(caption), } elif caption is None: - db_query = list( - col_videos.find( - {"user": current_user.user, "album": album, "filename": re.compile(q)}, - limit=page_size, - skip=skip, - ).sort("dates.uploaded", DESCENDING) - ) + db_query = { + "user": current_user.user, + "album": album, + "filename": re.compile(q), + } db_query_count = { "user": current_user.user, "album": album, "caption": re.compile(q), } else: - db_query = list( - col_videos.find( - { - "user": current_user.user, - "album": album, - "filename": re.compile(q), - "caption": re.compile(caption), - }, - limit=page_size, - skip=skip, - ).sort("dates.uploaded", DESCENDING) - ) + db_query = { + "user": current_user.user, + "album": album, + "filename": re.compile(q), + "caption": re.compile(caption), + } db_query_count = { "user": current_user.user, "album": album, @@ -426,7 +418,7 @@ async def video_find( } async for video in col_videos.find(db_query, limit=page_size, skip=skip).sort( - "dates.uploaded", DESCENDING + "dates.uploaded", direction=DESCENDING ): output["results"].append( {