Add debug logs to baby jail and fix playtime logic (#30158)

* add debug logs

* Update Model.cs

* fix playtime logic for null playtime

* remove unnecessary condition

* either me or the compiler is having a C# skill issue
This commit is contained in:
Chief-Engineer
2024-07-20 18:28:43 -05:00
committed by GitHub
parent c89186a26f
commit 6d664c9157
2 changed files with 15 additions and 1 deletions

View File

@@ -308,6 +308,12 @@ namespace Content.Server.Connection
return (false, "");
var isAccountAgeInvalid = record.FirstSeenTime.CompareTo(DateTimeOffset.Now - TimeSpan.FromMinutes(maxAccountAgeMinutes)) <= 0;
if (isAccountAgeInvalid)
{
_sawmill.Debug($"Baby jail will deny {userId} for account age {record.FirstSeenTime}"); // Remove on or after 2024-09
}
if (isAccountAgeInvalid && showReason)
{
var locAccountReason = reason != string.Empty
@@ -322,7 +328,12 @@ namespace Content.Server.Connection
}
var overallTime = ( await _db.GetPlayTimes(e.UserId)).Find(p => p.Tracker == PlayTimeTrackingShared.TrackerOverall);
var isTotalPlaytimeInvalid = overallTime == null || overallTime.TimeSpent.TotalMinutes >= maxPlaytimeMinutes;
var isTotalPlaytimeInvalid = overallTime != null && overallTime.TimeSpent.TotalMinutes >= maxPlaytimeMinutes;
if (isTotalPlaytimeInvalid)
{
_sawmill.Debug($"Baby jail will deny {userId} for playtime {overallTime!.TimeSpent}"); // Remove on or after 2024-09
}
if (isTotalPlaytimeInvalid && showReason)
{