From 1092a2d389a30508e81b35d2be89e486fc457a49 Mon Sep 17 00:00:00 2001 From: Daniil Okhlopkov <5613295+ohld@users.noreply.github.com> Date: Tue, 18 Jun 2024 18:40:40 +0100 Subject: [PATCH] show 5 last uploaded memes --- src/tgbot/handlers/upload/service.py | 2 +- src/tgbot/handlers/upload/stats.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/tgbot/handlers/upload/service.py b/src/tgbot/handlers/upload/service.py index ac6d0c2..01b94b8 100644 --- a/src/tgbot/handlers/upload/service.py +++ b/src/tgbot/handlers/upload/service.py @@ -135,7 +135,7 @@ async def get_uploaded_memes_of_user_id(user_id: int) -> list[dict[str, Any]]: AND S.added_by = {user_id} AND S.type = 'user upload' AND M.status IN ('ok', 'published') - ORDER BY M.created_at + ORDER BY M.created_at DESC """ return await fetch_all(text(query)) diff --git a/src/tgbot/handlers/upload/stats.py b/src/tgbot/handlers/upload/stats.py index 00ea910..9cf04df 100644 --- a/src/tgbot/handlers/upload/stats.py +++ b/src/tgbot/handlers/upload/stats.py @@ -60,7 +60,7 @@ async def handle_uploaded_memes_stats( # show stats for last 5 uploads: media = [] - for uploaded_meme in uploaded_memes[-5:]: + for uploaded_meme in uploaded_memes[:5]: views = uploaded_meme["nmemes_sent"] likes = uploaded_meme["nlikes"] dislikes = uploaded_meme["ndislikes"]