From 5ef46122499c5d120a8c299daf1255075f596acf Mon Sep 17 00:00:00 2001 From: nytmyr <53322305+nytmyr@users.noreply.github.com> Date: Tue, 16 Jul 2024 14:53:22 -0500 Subject: [PATCH] [Bug Fix] [Quest API] Fix getraididbycharid and getgroupidbycharid (#4417) --- common/database.cpp | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/common/database.cpp b/common/database.cpp index 69c86c575..5a3e9ff66 100644 --- a/common/database.cpp +++ b/common/database.cpp @@ -1629,16 +1629,29 @@ uint32 Database::GetGuildIDByCharID(uint32 character_id) uint32 Database::GetGroupIDByCharID(uint32 character_id) { - const auto& e = GroupIdRepository::FindOne(*this, character_id); + const auto& e = GroupIdRepository::GetWhere( + *this, + fmt::format( + "`character_id` = {}", + character_id + ) + ); - return e.character_id ? e.group_id : 0; + return e.size() == 1 ? e.front().group_id : 0; } uint32 Database::GetRaidIDByCharID(uint32 character_id) { - const auto& e = RaidMembersRepository::FindOne(*this, character_id); - return e.charid ? e.raidid : 0; + const auto& e = RaidMembersRepository::GetWhere( + *this, + fmt::format( + "`charid` = {}", + character_id + ) + ); + + return e.size() == 1 ? e.front().raidid : 0; } int64 Database::CountInvSnapshots()