From 423fa04d1c2cd783dfff4f39377a8e7564238857 Mon Sep 17 00:00:00 2001 From: Arutemu64 Date: Wed, 13 Sep 2023 18:31:54 +0300 Subject: [PATCH] Fix for incorrect received achievements indicator display --- src/db/repositories/achievement.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/db/repositories/achievement.py b/src/db/repositories/achievement.py index 81b1d85..8c050ec 100644 --- a/src/db/repositories/achievement.py +++ b/src/db/repositories/achievement.py @@ -1,4 +1,4 @@ -from sqlalchemy import select +from sqlalchemy import and_, select from sqlalchemy.ext.asyncio import AsyncSession from ..models import Achievement, ReceivedAchievement @@ -36,7 +36,10 @@ async def get_achievements_page( if user_id: stmt = stmt.outerjoin( ReceivedAchievement, - Achievement.id == ReceivedAchievement.achievement_id, + and_( + Achievement.id == ReceivedAchievement.achievement_id, + ReceivedAchievement.user_id == user_id, + ), ) return (await self.session.execute(stmt)).all() else: