Added returned player count

This commit is contained in:
2019-06-04 04:23:12 +10:00
parent d1c32e7259
commit c203da5a24
2 changed files with 2 additions and 1 deletions
+1 -1
View File
@@ -9,7 +9,7 @@ let { log } = require('../common/utilities.js');
const runDailyDiagnostics = (connection) => {
let dailyJob = new CronJob('0 0 * * * *', () => {
let query = 'INSERT INTO diagnostics (playerCount, totalGold, totalRecruitments, totalDeaths, totalCombats) VALUES ((SELECT COUNT(*) FROM profiles), (SELECT SUM(gold) FROM profiles), (IFNULL((SELECT SUM(quantity) FROM diagnosticsEvents WHERE eventName = "recruit"), 0)), (IFNULL((SELECT SUM(quantity) FROM diagnosticsEvents WHERE eventName = "death"), 0)), (SELECT COUNT(*) FROM pastCombat WHERE eventTime >= DATE_SUB(CURRENT_TIMESTAMP(), INTERVAL 1 DAY)));';
let query = 'INSERT INTO diagnostics (playerCount, returnedPlayerCount, totalGold, totalRecruitments, totalDeaths, totalCombats) VALUES ((SELECT COUNT(*) FROM profiles), (SELECT COUNT(*) FROM profiles WHERE (recruits + soldiers + spies + scientists) >= 2), (SELECT SUM(gold) FROM profiles), (IFNULL((SELECT SUM(quantity) FROM diagnosticsEvents WHERE eventName = "recruit"), 0)), (IFNULL((SELECT SUM(quantity) FROM diagnosticsEvents WHERE eventName = "death"), 0)), (SELECT COUNT(*) FROM pastCombat WHERE eventTime >= DATE_SUB(CURRENT_TIMESTAMP(), INTERVAL 1 DAY)));';
connection.query(query, (err) => {
if (err) throw err;
+1
View File
@@ -4,6 +4,7 @@ CREATE TABLE IF NOT EXISTS diagnostics (
td TIMESTAMP DEFAULT CURRENT_TIMESTAMP(),
playerCount INTEGER NOT NULL DEFAULT 0,
returnedPlayerCount INTEGER NOT NULL DEFAULT 0,
totalGold INTEGER NOT NULL DEFAULT 0,
totalRecruitments INTEGER NOT NULL DEFAULT 0,
totalDeaths INTEGER NOT NULL DEFAULT 0,