Update db-log-addOn.js

This commit is contained in:
Skillet 2023-03-04 10:27:04 -05:00 committed by GitHub
parent 22631f081d
commit 29568dcb6f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -99,19 +99,21 @@ export default class DBLogPlayerTime extends DBLog {
);
console.log('last tick found:', lastTickTime);
let lastServerTime = lastTickTime.time;
console.log('last time found:', lastServerTime);
let playerOnlineID = [];
for (player of this.server.players){
playerOnlineID.push(player.steamID);
}
console.log('players online:', playerOnlineID);
const {not} = Sequelize.Op;
const Op = require('sequelize').Op;
let rowUpdate = await this.models.PlayerTime.update(
{ leaveTime: lastServerTime },
{ where: {
leaveTime: null,
server: this.options.overrideServerID || this.server.id,
[not]: [{player: playerOnlineID}]
{ [Op.ne]: { player: playerOnlineID } }
} }
{ logging: console.log }
);
console.log('updated playerTimes row count: %i', rowUpdate[0]);
console.log('finish DB repair');