separate home graph into it's own table

This commit is contained in:
Ben Wilson
2024-01-16 19:37:29 -05:00
parent bbc14e2272
commit 6bc42defef
8 changed files with 173 additions and 5 deletions
@@ -85,6 +85,34 @@ export class ClientStatisticsService {
}
public async getChartDataForSiteSince(date: Date) {
const query = `
SELECT
time AS label,
ROUND(((SUM(shares) * 4294967296) / 600)) AS data
FROM
client_statistics_entity AS entry
WHERE
entry.time > ${date.getTime()}
GROUP BY
time
ORDER BY
time
LIMIT 144;
`;
const result: any[] = await this.clientStatisticsRepository.query(query);
return result.map(res => {
res.label = new Date(parseInt(res.label)).toISOString();
return res;
}).slice(0, result.length - 1)
}
// public async getHashRateForAddress(address: string) {