From ab8ac81df67934934776b325b7f12493cfe6fea3 Mon Sep 17 00:00:00 2001 From: Alex King <89047260+Kinglykrab@users.noreply.github.com> Date: Thu, 28 Mar 2024 16:33:49 -0400 Subject: [PATCH] [Bug Fix] Fix Group Leadership (#4214) * [Bug Fix] Fix Group Leadership # Notes - We were not sending anything to `group_leaders` table if we did not already have an existing row. # Video * Update database.cpp --- common/database.cpp | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/common/database.cpp b/common/database.cpp index ce6e1c312..7f45e253d 100644 --- a/common/database.cpp +++ b/common/database.cpp @@ -1114,14 +1114,12 @@ void Database::SetGroupLeaderName(uint32 group_id, const std::string& name) e.leadername = name; - const int updated_leader = GroupLeadersRepository::UpdateOne(*this, e); - - if (!updated_leader) { + if (e.gid) { + GroupLeadersRepository::UpdateOne(*this, e); return; } e.gid = group_id; - e.leadername = name; e.marknpc = std::string(); e.leadershipaa = std::string(); e.maintank = std::string(); @@ -1130,7 +1128,7 @@ void Database::SetGroupLeaderName(uint32 group_id, const std::string& name) e.mentoree = std::string(); e.mentor_percent = 0; - GroupLeadersRepository::UpdateOne(*this, e); + GroupLeadersRepository::InsertOne(*this, e); } std::string Database::GetGroupLeaderName(uint32 group_id)