Update db-log-addOn.js

This commit is contained in:
Skillet 2023-03-06 11:39:00 -05:00 committed by GitHub
parent fe5a9c0670
commit 3ec6c523dd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -93,12 +93,15 @@ export default class DBLogPlayerTime extends DBLog {
console.log('starting DB repair');
await super.repairDB();
console.log('starting DB repair for addOn');
let lastTickTime = await this.models.TickRate.findOne(
{ where: { server: this.options.overrideServerID || this.server.id},
order: [['id', 'DESC']]}
let lastTickTime = await this.models.TickRate.findOne({
where: { server: this.options.overrideServerID || this.server.id},
order: [['id', 'DESC']],
logging: console.log
}
);
console.log('last tick found:', lastTickTime);
let lastServerTime = String(lastTickTime.time);
let lastServerDate = lastTickTime.time;
let lastServerTime = lastServerDate.getFullYear() + '-' + (lastServerDate.getMonth() + 1) + '-' + lastServerDate.getDate()+' '+lastServerDate.getHours()+':'+lastServerDate.getMinutes()+':'+lastServerDate.getSeconds();
console.log('last time found:', lastServerTime);
let playerOnlineID = [];
playerOnlineID.push(0);
@ -111,7 +114,7 @@ export default class DBLogPlayerTime extends DBLog {
{ leaveTime: (lastServerTime) },
{ where: {
leaveTime: {[is]: null},
server: (this.options.overrideServerID || this.server.id),
server: this.options.overrideServerID || this.server.id,
player: {[notIn]: playerOnlineID}
},
logging: console.log