From 53af31370de7c014428e8bad0322ac2f8697dc78 Mon Sep 17 00:00:00 2001 From: Skillet Date: Mon, 6 Mar 2023 09:52:36 -0500 Subject: [PATCH] Update db-log-addOn.js --- squadjsPlugins/db-log-addOn.js | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/squadjsPlugins/db-log-addOn.js b/squadjsPlugins/db-log-addOn.js index 3770c51..23ef886 100644 --- a/squadjsPlugins/db-log-addOn.js +++ b/squadjsPlugins/db-log-addOn.js @@ -102,21 +102,21 @@ export default class DBLogPlayerTime extends DBLog { console.log('last time found:', lastServerTime); let playerOnlineID = []; playerOnlineID.push(0); -// for (const player of this.server.players){ -// playerOnlineID.push(player.steamID); -// } + for (const player of this.server.players){ + playerOnlineID.push(player.steamID); + } console.log('players online:', playerOnlineID); - const {ne} = Sequelize.Op; -// let rowUpdate = await this.models.PlayerTime.update( -// { leaveTime: lastServerTime }, -// { where: { -// leaveTime: null, -// server: this.options.overrideServerID || this.server.id, -// player: { [ne]: playerOnlineID } -// } }, -// { logging: console.log } -// ); -// console.log('updated playerTimes row count: %i', rowUpdate[0]); +// const {ne, not, in} = Sequelize.Op; + let rowUpdate = await this.models.PlayerTime.update( + { leaveTime: lastServerTime }, + { where: { + leaveTime: {[Op.not]: null}, + server: this.options.overrideServerID || this.server.id, + player: { [Op.ne]: {[Op.in]: playerOnlineID} } + } }, + { logging: console.log } + ); + console.log('updated playerTimes row count: %i', rowUpdate[0]); console.log('finish DB repair'); }