force lastConnection date to not be nil
This commit is contained in:
2 files changed
+346
No files matched your search
@@ -64,6 +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);
|
||||
let oldUnixTime = Math.floor(playerStat.lastConnectionDate.getTime()/1000);
|
||||
let seconds = unixTime - oldUnixTime;
|
||||
let sessionTime = client.secondsToDhms(seconds);
|
||||
@@ -106,6 +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);
|
||||
|
||||
playerStat.lastPos = playerStat.pos;
|
||||
playerStat.pos = info.pos;
|
||||
|
||||
Reference in new issue
Block a user