Update db-log-addOn.js

This commit is contained in:
Skillet 2023-03-12 19:20:39 -04:00 committed by GitHub
parent b18ea8b223
commit 0538f6face
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -171,6 +171,17 @@ export default class DBLogPlayerTime extends DBLog {
}
});
console.log(curPlayer);
let curplayerarr = [];
for (const oneplayer in curPlayer){
curplayerarr.push({
startTime: timeNow,
endTime: null,
serverState: newState,
session: oneplayer.session,
server: oneplayer.server,
player: oneplayer.player
});
}
await this.models.PlayerTimeNew.update(
{ endTime: timeNow },
{
@ -181,22 +192,9 @@ export default class DBLogPlayerTime extends DBLog {
}
}
);
await this.models.PlayerTimeNew.bulkCreate(curPlayer,{
await this.models.PlayerTimeNew.bulkCreate(curplayerarr,{
fields: ['startTime', 'endTime','serverState','session','server','player']
});
await this.models.PlayerTimeNew.update(
{
serverState: newState,
startTime: timeNow
},
{
where: {
endTime: null,
serverState: oldState,
server: this.options.overrideServerID || this.server.id
}
}
);
this.seeding = newState;
}