parent
8f78bffc46
commit
be7d32f7f2
@ -22,5 +22,5 @@ export const InfluxWriteAPI = influxClient.getWriteApi(
|
||||
);
|
||||
export const InfluxQueryAPI = influxClient.getQueryApi(INFLUXDB_ORG);
|
||||
|
||||
require("./updateData");
|
||||
require("./api");
|
||||
require("./services/updateData");
|
||||
require("./services/api");
|
||||
|
@ -23,15 +23,15 @@ app.get("/analytics", async (req, res) => {
|
||||
const rows = await InfluxQueryAPI.collectRows(getPlayerHistoryQuery);
|
||||
let history = rows.map((row: any) => ({
|
||||
time: row._time,
|
||||
value: row._value.toFixed(0),
|
||||
value: row._value !== null ? row._value.toFixed(0) : null,
|
||||
}));
|
||||
history = history.sort(
|
||||
(a: any, b: any) => new Date(a.time).getTime() - new Date(b.time).getTime()
|
||||
);
|
||||
|
||||
return res.json({
|
||||
serverTimeTaken: new Date().getTime() - before + "ms",
|
||||
history: history,
|
||||
serverTimeTaken: new Date().getTime() - before,
|
||||
});
|
||||
});
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user