fix warn stats after migrating to ef core 3.0

This commit is contained in:
13xforever 2019-11-06 02:47:10 +05:00
parent 34e6581f8d
commit e62cd795ae

View File

@ -94,7 +94,7 @@ namespace CompatBot.Commands
}
var yesterday = DateTime.UtcNow.AddDays(-1).Ticks;
var warnCount = db.Warning.Count(w => w.Timestamp > yesterday);
var lastWarn = db.Warning.LastOrDefault()?.Timestamp;
var lastWarn = timestamps.Any() ? timestamps.Last() : (long?)null;
if (lastWarn.HasValue)
longestGapBetweenWarning = Math.Max(longestGapBetweenWarning, DateTime.UtcNow.Ticks - lastWarn.Value);
// most warnings per 24h