mirror of
https://gitlab.com/Kwoth/nadekobot.git
synced 2025-09-10 17:28:27 -04:00
Revert "Reverted club xp updates, and non-opt in xp system as it's causing db locking"
This reverts commit 6c169e057b
.
This commit is contained in:
@@ -188,12 +188,12 @@ public class XpService : INService, IReadyExecutor, IExecNoCommand
|
|||||||
},
|
},
|
||||||
(_, n) => n);
|
(_, n) => n);
|
||||||
|
|
||||||
// await ctx.Clubs
|
await ctx.Clubs
|
||||||
// .Where(x => x.Members.Any(m => group.Contains(m.UserId)))
|
.Where(x => x.Members.Any(m => group.Contains(m.UserId)))
|
||||||
// .UpdateAsync(old => new()
|
.UpdateAsync(old => new()
|
||||||
// {
|
{
|
||||||
// Xp = old.Xp + (group.Key * old.Members.Count(m => group.Contains(m.UserId)))
|
Xp = old.Xp + (group.Key * old.Members.Count(m => group.Contains(m.UserId)))
|
||||||
// });
|
});
|
||||||
|
|
||||||
dus.AddRange(items);
|
dus.AddRange(items);
|
||||||
}
|
}
|
||||||
@@ -215,40 +215,40 @@ public class XpService : INService, IReadyExecutor, IExecNoCommand
|
|||||||
|
|
||||||
gxps.AddRange(items);
|
gxps.AddRange(items);
|
||||||
|
|
||||||
// var missingUserIds = group.Where(userId => !items.Any(x => x.UserId == userId)).ToArray();
|
var missingUserIds = group.Where(userId => !items.Any(x => x.UserId == userId)).ToArray();
|
||||||
// foreach (var userId in missingUserIds)
|
foreach (var userId in missingUserIds)
|
||||||
// {
|
{
|
||||||
// await ctx
|
await ctx
|
||||||
// .UserXpStats
|
.UserXpStats
|
||||||
// .ToLinqToDBTable()
|
.ToLinqToDBTable()
|
||||||
// .InsertOrUpdateAsync(() => new UserXpStats()
|
.InsertOrUpdateAsync(() => new UserXpStats()
|
||||||
// {
|
{
|
||||||
// UserId = userId,
|
UserId = userId,
|
||||||
// GuildId = guildId,
|
GuildId = guildId,
|
||||||
// Xp = group.Key,
|
Xp = group.Key,
|
||||||
// DateAdded = DateTime.UtcNow,
|
DateAdded = DateTime.UtcNow,
|
||||||
// AwardedXp = 0,
|
AwardedXp = 0,
|
||||||
// NotifyOnLevelUp = XpNotificationLocation.None
|
NotifyOnLevelUp = XpNotificationLocation.None
|
||||||
// },
|
},
|
||||||
// _ => new()
|
_ => new()
|
||||||
// {
|
{
|
||||||
//
|
|
||||||
// },
|
},
|
||||||
// () => new()
|
() => new()
|
||||||
// {
|
{
|
||||||
// UserId = userId
|
UserId = userId
|
||||||
// });
|
});
|
||||||
// }
|
}
|
||||||
//
|
|
||||||
// if (missingUserIds.Length > 0)
|
if (missingUserIds.Length > 0)
|
||||||
// {
|
{
|
||||||
// var missingItems = await ctx.UserXpStats
|
var missingItems = await ctx.UserXpStats
|
||||||
// .ToLinqToDBTable()
|
.ToLinqToDBTable()
|
||||||
// .Where(x => missingUserIds.Contains(x.UserId))
|
.Where(x => missingUserIds.Contains(x.UserId))
|
||||||
// .ToArrayAsyncLinqToDB();
|
.ToArrayAsyncLinqToDB();
|
||||||
//
|
|
||||||
// gxps.AddRange(missingItems);
|
gxps.AddRange(missingItems);
|
||||||
// }
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user