1
0
mirror of https://github.com/RaidMax/IW4M-Admin.git synced 2025-06-22 13:10:26 -05:00

update server distribution calculations to account for performance bucket

This commit is contained in:
RaidMax
2023-05-07 20:33:58 -05:00
parent 2d20e69856
commit ca730425da
7 changed files with 217 additions and 113 deletions

View File

@ -145,11 +145,12 @@ namespace Stats.Helpers
};
}
public static Expression<Func<EFClientStatistics, bool>> GetRankingFunc(int minPlayTime, double? zScore = null,
public static Expression<Func<EFClientStatistics, bool>> GetRankingFunc(int minPlayTime, TimeSpan expiration, double? zScore = null,
long? serverId = null)
{
return (stats) => (serverId == null || stats.ServerId == serverId) &&
stats.UpdatedAt >= Extensions.FifteenDaysAgo() &&
var oldestStat = DateTimeOffset.UtcNow.Subtract(expiration);
return stats => (serverId == null || stats.ServerId == serverId) &&
stats.UpdatedAt >= oldestStat &&
stats.Client.Level != EFClient.Permission.Banned &&
stats.TimePlayed >= minPlayTime
&& (zScore == null || stats.ZScore > zScore);