fix
Some checks failed
deploy / deploy (push) Has been cancelled

This commit is contained in:
Lee 2023-10-27 15:56:42 +01:00
parent 8f78bffc46
commit be7d32f7f2
2 changed files with 4 additions and 4 deletions

@ -22,5 +22,5 @@ export const InfluxWriteAPI = influxClient.getWriteApi(
); );
export const InfluxQueryAPI = influxClient.getQueryApi(INFLUXDB_ORG); export const InfluxQueryAPI = influxClient.getQueryApi(INFLUXDB_ORG);
require("./updateData"); require("./services/updateData");
require("./api"); require("./services/api");

@ -23,15 +23,15 @@ app.get("/analytics", async (req, res) => {
const rows = await InfluxQueryAPI.collectRows(getPlayerHistoryQuery); const rows = await InfluxQueryAPI.collectRows(getPlayerHistoryQuery);
let history = rows.map((row: any) => ({ let history = rows.map((row: any) => ({
time: row._time, time: row._time,
value: row._value.toFixed(0), value: row._value !== null ? row._value.toFixed(0) : null,
})); }));
history = history.sort( history = history.sort(
(a: any, b: any) => new Date(a.time).getTime() - new Date(b.time).getTime() (a: any, b: any) => new Date(a.time).getTime() - new Date(b.time).getTime()
); );
return res.json({ return res.json({
serverTimeTaken: new Date().getTime() - before + "ms",
history: history, history: history,
serverTimeTaken: new Date().getTime() - before,
}); });
}); });