From 073c318671b468e8499c715a6ea04b019e9435b8 Mon Sep 17 00:00:00 2001 From: Sven Heidemann Date: Wed, 16 Aug 2023 18:19:21 +0200 Subject: [PATCH] Fixed achievement server filter #1.1.0.rc2 --- kdb-bot/src/bot_data/model/achievement.py | 9 +++++++++ .../bot_data/service/achievements_repository_service.py | 4 ++-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/kdb-bot/src/bot_data/model/achievement.py b/kdb-bot/src/bot_data/model/achievement.py index 0b33b693..ebce645d 100644 --- a/kdb-bot/src/bot_data/model/achievement.py +++ b/kdb-bot/src/bot_data/model/achievement.py @@ -108,6 +108,15 @@ class Achievement(TableABC): """ ) + @staticmethod + def get_select_by_server_id_string(id: int) -> str: + return str( + f""" + SELECT * FROM `Achievements` + WHERE `ServerId` = {id}; + """ + ) + @property def insert_string(self) -> str: return str( diff --git a/kdb-bot/src/bot_data/service/achievements_repository_service.py b/kdb-bot/src/bot_data/service/achievements_repository_service.py index 9c7e9117..b848fb5a 100644 --- a/kdb-bot/src/bot_data/service/achievements_repository_service.py +++ b/kdb-bot/src/bot_data/service/achievements_repository_service.py @@ -65,8 +65,8 @@ class AchievementRepositoryService(AchievementRepositoryABC): def get_achievements_by_server_id(self, server_id: int) -> List[Achievement]: achievements = List(Achievement) - self._logger.trace(__name__, f"Send SQL command: {Achievement.get_select_by_id_string(server_id)}") - results = self._context.select(Achievement.get_select_all_string()) + self._logger.trace(__name__, f"Send SQL command: {Achievement.get_select_by_server_id_string(server_id)}") + results = self._context.select(Achievement.get_select_by_server_id_string(server_id)) for result in results: self._logger.trace(__name__, f"Get user with id {result[0]}") achievements.append(self._from_result(result))