Changes of heart no longer counts affinity removals, and counts each user only once

This commit is contained in:
Kwoth 2017-03-14 09:03:21 +01:00
parent 506d058ecc
commit ac671a7f0c

View File

@ -395,7 +395,7 @@ namespace NadekoBot.Modules.Gambling
target = Context.User; target = Context.User;
WaifuInfo w; WaifuInfo w;
IList<WaifuInfo> claims; IList<WaifuInfo> claims;
int divorces = 0; int divorces;
using (var uow = DbHandler.UnitOfWork()) using (var uow = DbHandler.UnitOfWork())
{ {
w = uow.Waifus.ByWaifuUserId(target.Id); w = uow.Waifus.ByWaifuUserId(target.Id);
@ -494,7 +494,10 @@ namespace NadekoBot.Modules.Gambling
int count; int count;
using (var uow = DbHandler.UnitOfWork()) 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; AffinityTitles title;