From ac671a7f0cc1ed7a5aed7ef46c52d859f66d5bc6 Mon Sep 17 00:00:00 2001 From: Kwoth Date: Tue, 14 Mar 2017 09:03:21 +0100 Subject: [PATCH] Changes of heart no longer counts affinity removals, and counts each user only once --- .../Modules/Gambling/Commands/WaifuClaimCommands.cs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/NadekoBot/Modules/Gambling/Commands/WaifuClaimCommands.cs b/src/NadekoBot/Modules/Gambling/Commands/WaifuClaimCommands.cs index 7f3e4b03..5605e3e6 100644 --- a/src/NadekoBot/Modules/Gambling/Commands/WaifuClaimCommands.cs +++ b/src/NadekoBot/Modules/Gambling/Commands/WaifuClaimCommands.cs @@ -395,7 +395,7 @@ namespace NadekoBot.Modules.Gambling target = Context.User; WaifuInfo w; IList claims; - int divorces = 0; + int divorces; using (var uow = DbHandler.UnitOfWork()) { w = uow.Waifus.ByWaifuUserId(target.Id); @@ -494,7 +494,10 @@ namespace NadekoBot.Modules.Gambling int count; using (var uow = DbHandler.UnitOfWork()) { - count = uow._context.WaifuUpdates.Count(w => w.User.UserId == userId && w.UpdateType == WaifuUpdateType.AffinityChanged); + count = uow._context.WaifuUpdates + .Where(w => w.User.UserId == userId && w.UpdateType == WaifuUpdateType.AffinityChanged && w.New != null) + .GroupBy(x => x.New) + .Count(); } AffinityTitles title;