added new player ticker
This commit is contained in:
@@ -33,10 +33,17 @@ const statisticsRequest = (connection) => (req, res) => {
|
|||||||
let activity = results[0].activity;
|
let activity = results[0].activity;
|
||||||
let activePercentage = round(activity / playerCount * 100);
|
let activePercentage = round(activity / playerCount * 100);
|
||||||
|
|
||||||
|
let query = 'SELECT COUNT(*) AS newPlayers FROM profiles WHERE td >= DATE_SUB(CURRENT_TIMESTAMP(), INTERVAL 1 DAY)';
|
||||||
|
connection.query(query, (err, results) => {
|
||||||
|
if (err) throw err;
|
||||||
|
|
||||||
|
let newPlayers = results[0].newPlayers;
|
||||||
|
|
||||||
res.status(200).json({
|
res.status(200).json({
|
||||||
'Player Count': playerCount,
|
'Player Count': playerCount,
|
||||||
'Active Players': activity,
|
'Active Players': activity,
|
||||||
'Active Percentage': { string: `${activePercentage}%`, color: activePercentage >= 10 ? 'lightgreen' : activePercentage >= 5 ? 'yellow' : 'red'},
|
'Active Percentage': { string: `${activePercentage}%`, color: activePercentage >= 10 ? 'lightgreen' : activePercentage >= 5 ? 'yellow' : 'red'},
|
||||||
|
'New Players': newPlayers > 0 ? { string: `${newPlayers} (Welcome aboard!)`, color: 'lightgreen' } : { string: '0', color: 'yellow' },
|
||||||
'Recruits Total': recruitTotal,
|
'Recruits Total': recruitTotal,
|
||||||
'Soldier Total': soldierTotal,
|
'Soldier Total': soldierTotal,
|
||||||
'Scientist Total': scientistTotal,
|
'Scientist Total': scientistTotal,
|
||||||
@@ -48,6 +55,7 @@ const statisticsRequest = (connection) => (req, res) => {
|
|||||||
res.end();
|
res.end();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
|
|||||||
Reference in New Issue
Block a user