From 90314cec02efe2814de2a49cb62d483e67f7760a Mon Sep 17 00:00:00 2001 From: Braeden Sowinski Date: Thu, 8 Jun 2023 15:44:42 -0700 Subject: [PATCH] force lastConnection date to not be nil --- util/LogsHandler.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/util/LogsHandler.js b/util/LogsHandler.js index 3891cc8..633cda3 100644 --- a/util/LogsHandler.js +++ b/util/LogsHandler.js @@ -64,7 +64,7 @@ module.exports = { let newDt = await client.getDateEST(info.time); let unixTime = Math.floor(newDt.getTime()/1000); - if (!client.exists(playerStat.lastConnectionDate)) playerStat.lastConnectionDate = client.getDateEST(info.time); + if (!client.exists(playerStat.lastConnectionDate)) playerStat.lastConnectionDate = await client.getDateEST(info.time); let oldUnixTime = Math.floor(playerStat.lastConnectionDate.getTime()/1000); let seconds = unixTime - oldUnixTime; let sessionTime = client.secondsToDhms(seconds); @@ -107,7 +107,7 @@ module.exports = { let playerStat = stats.find(stat => stat.playerID == info.playerID) let playerStatIndex = stats.indexOf(playerStat); if (playerStat == undefined) playerStat = client.getDefaultPlayerStats(info.player, info.playerID); - if (!client.exists(playerStat.lastConnectionDate)) playerStat.lastConnectionDate = client.getDateEST(info.time); + if (!client.exists(playerStat.lastConnectionDate)) playerStat.lastConnectionDate = await client.getDateEST(info.time); playerStat.lastPos = playerStat.pos; playerStat.pos = info.pos;