Fixed achievement server filter #1.1.0.rc2

This commit is contained in:
Sven Heidemann 2023-08-16 18:19:21 +02:00
parent caeec47b7c
commit 073c318671
2 changed files with 11 additions and 2 deletions

View File

@ -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 @property
def insert_string(self) -> str: def insert_string(self) -> str:
return str( return str(

View File

@ -65,8 +65,8 @@ class AchievementRepositoryService(AchievementRepositoryABC):
def get_achievements_by_server_id(self, server_id: int) -> List[Achievement]: def get_achievements_by_server_id(self, server_id: int) -> List[Achievement]:
achievements = List(Achievement) achievements = List(Achievement)
self._logger.trace(__name__, f"Send SQL command: {Achievement.get_select_by_id_string(server_id)}") self._logger.trace(__name__, f"Send SQL command: {Achievement.get_select_by_server_id_string(server_id)}")
results = self._context.select(Achievement.get_select_all_string()) results = self._context.select(Achievement.get_select_by_server_id_string(server_id))
for result in results: for result in results:
self._logger.trace(__name__, f"Get user with id {result[0]}") self._logger.trace(__name__, f"Get user with id {result[0]}")
achievements.append(self._from_result(result)) achievements.append(self._from_result(result))