1
0
mirror of https://github.com/RaidMax/IW4M-Admin.git synced 2025-06-10 15:20:48 -05:00

fix bug with wrong locale when master is down

fix issue with reapplying penalties
show subset of penalties that are linked on client profile
This commit is contained in:
RaidMax
2019-06-28 16:57:01 -05:00
parent 050df67ee1
commit 1a8c8634b3
5 changed files with 35 additions and 15 deletions

View File

@ -104,6 +104,8 @@ namespace SharedLibraryCore.Services
/// <returns></returns>
public async Task<IList<PenaltyInfo>> GetClientPenaltyForMetaAsync(int clientId, int count, int offset, DateTime? startAt)
{
var linkedPenaltyType = Utilities.LinkedPenaltyTypes();
using (var ctx = new DatabaseContext(true))
{
var linkId = await ctx.Clients.AsNoTracking()
@ -112,7 +114,7 @@ namespace SharedLibraryCore.Services
.FirstOrDefaultAsync();
var iqPenalties = ctx.Penalties.AsNoTracking()
.Where(_penalty => _penalty.OffenderId == clientId || _penalty.PunisherId == clientId || _penalty.LinkId == linkId)
.Where(_penalty => _penalty.OffenderId == clientId || _penalty.PunisherId == clientId || (linkedPenaltyType.Contains(_penalty.Type) && _penalty.LinkId == linkId))
.Where(_penalty => _penalty.When <= startAt)
.OrderByDescending(_penalty => _penalty.When)
.Skip(offset)
@ -136,8 +138,7 @@ namespace SharedLibraryCore.Services
#if DEBUG == true
var querySql = iqPenalties.ToSql();
#endif
return await iqPenalties.ToListAsync();
return await iqPenalties.Distinct().ToListAsync();
}
}