mirror of
https://gitlab.com/Kwoth/nadekobot.git
synced 2025-09-10 17:28:27 -04:00
Removed redundant parenthesis
This commit is contained in:
@@ -48,11 +48,11 @@ public static class DiscordUserExtensions
|
||||
public static int GetUserGlobalRank(this DbSet<DiscordUser> users, ulong id)
|
||||
{
|
||||
return users.AsQueryable()
|
||||
.Where(x => x.TotalXp > (users
|
||||
.Where(x => x.TotalXp > users
|
||||
.AsQueryable()
|
||||
.Where(y => y.UserId == id)
|
||||
.Select(y => y.TotalXp)
|
||||
.FirstOrDefault()))
|
||||
.FirstOrDefault())
|
||||
.Count() + 1;
|
||||
}
|
||||
|
||||
|
@@ -69,10 +69,11 @@ public static class GuildConfigExtensions
|
||||
/// <summary>
|
||||
/// Gets and creates if it doesn't exist a config for a guild.
|
||||
/// </summary>
|
||||
/// <param name="guildId">For which guild</param>
|
||||
/// <param name="includes">Use to manipulate the set however you want</param>
|
||||
/// <param name="ctx">Context</param>
|
||||
/// <param name="guildId">Id of the guide</param>
|
||||
/// <param name="includes">Use to manipulate the set however you want. Pass null to include everything</param>
|
||||
/// <returns>Config for the guild</returns>
|
||||
public static GuildConfig GuildConfigsForId(this NadekoContext ctx, ulong guildId, Func<DbSet<GuildConfig>, IQueryable<GuildConfig>> includes = null)
|
||||
public static GuildConfig GuildConfigsForId(this NadekoContext ctx, ulong guildId, Func<DbSet<GuildConfig>, IQueryable<GuildConfig>> includes)
|
||||
{
|
||||
GuildConfig config;
|
||||
|
||||
@@ -91,13 +92,13 @@ public static class GuildConfigExtensions
|
||||
|
||||
if (config is null)
|
||||
{
|
||||
ctx.GuildConfigs.Add((config = new()
|
||||
ctx.GuildConfigs.Add(config = new()
|
||||
{
|
||||
GuildId = guildId,
|
||||
Permissions = Permissionv2.GetDefaultPermlist,
|
||||
WarningsInitialized = true,
|
||||
WarnPunishments = DefaultWarnPunishments,
|
||||
}));
|
||||
});
|
||||
ctx.SaveChanges();
|
||||
}
|
||||
|
||||
@@ -150,11 +151,11 @@ public static class GuildConfigExtensions
|
||||
|
||||
if (config is null) // if there is no guildconfig, create new one
|
||||
{
|
||||
ctx.GuildConfigs.Add((config = new()
|
||||
ctx.GuildConfigs.Add(config = new()
|
||||
{
|
||||
GuildId = guildId,
|
||||
Permissions = Permissionv2.GetDefaultPermlist
|
||||
}));
|
||||
});
|
||||
ctx.SaveChanges();
|
||||
}
|
||||
else if (config.Permissions is null || !config.Permissions.Any()) // if no perms, add default ones
|
||||
|
@@ -60,12 +60,11 @@ public static class UserXpExtensions
|
||||
return xps
|
||||
.AsQueryable()
|
||||
.AsNoTracking()
|
||||
.Where(x => x.GuildId == guildId && ((x.Xp + x.AwardedXp) >
|
||||
(xps.AsQueryable()
|
||||
.Where(y => y.UserId == userId && y.GuildId == guildId)
|
||||
.Select(y => y.Xp + y.AwardedXp)
|
||||
.FirstOrDefault())
|
||||
))
|
||||
.Where(x => x.GuildId == guildId && x.Xp + x.AwardedXp >
|
||||
xps.AsQueryable()
|
||||
.Where(y => y.UserId == userId && y.GuildId == guildId)
|
||||
.Select(y => y.Xp + y.AwardedXp)
|
||||
.FirstOrDefault())
|
||||
.Count() + 1;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user