Add server stats to fe
This commit is contained in:
@@ -15,12 +15,19 @@ app.get('/', (req, res) => {
|
||||
})
|
||||
|
||||
app.post('/api/serverstats/gamestats', jsonParser, async (req, res) => {
|
||||
let startSeconds = 0
|
||||
let endSeconds = Number.MAX_SAFE_INTEGER
|
||||
|
||||
const month = req.body.monthId % 12
|
||||
const year = Math.floor(req.body.monthId / 12) + 2023
|
||||
if (req.body.monthId != -1) {
|
||||
const month = req.body.monthId % 12
|
||||
const year = Math.floor(req.body.monthId / 12) + 2023
|
||||
|
||||
const startDate = new Date(year, month, 1)
|
||||
const endDate = new Date(year, month + 1, -1)
|
||||
const startDate = new Date(year, month, 1)
|
||||
const endDate = new Date(year, month + 1, -1)
|
||||
|
||||
startSeconds = startDate.getTime() / 1000
|
||||
endSeconds = endDate.getTime() / 1000
|
||||
}
|
||||
|
||||
const serverGameStats = await database.query(
|
||||
'SELECT ' +
|
||||
@@ -34,8 +41,8 @@ app.post('/api/serverstats/gamestats', jsonParser, async (req, res) => {
|
||||
{
|
||||
type: QueryTypes.SELECT,
|
||||
replacements: {
|
||||
startSeconds: startDate.getTime() / 1000,
|
||||
endSeconds: endDate.getTime() / 1000
|
||||
startSeconds,
|
||||
endSeconds
|
||||
}
|
||||
}
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user