From 5fd9f988078e7865b1b5fb1e84e3303eed0ed113 Mon Sep 17 00:00:00 2001 From: Ben Wilson Date: Mon, 22 Jan 2024 17:32:34 -0500 Subject: [PATCH] index, dead code --- .../client-statistics.service.ts | 77 ------------------- src/ORM/client/client.entity.ts | 1 + 2 files changed, 1 insertion(+), 77 deletions(-) diff --git a/src/ORM/client-statistics/client-statistics.service.ts b/src/ORM/client-statistics/client-statistics.service.ts index ca270a8..683785f 100644 --- a/src/ORM/client-statistics/client-statistics.service.ts +++ b/src/ORM/client-statistics/client-statistics.service.ts @@ -56,84 +56,7 @@ export class ClientStatisticsService { .execute(); } - public async getChartDataForSite() { - var yesterday = new Date(new Date().getTime() - (24 * 60 * 60 * 1000)); - - const query = ` - SELECT - time AS label, - ROUND(((SUM(shares) * 4294967296) / 600)) AS data - FROM - client_statistics_entity AS entry - WHERE - entry.time > ${yesterday.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 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) { - - // const oneHour = new Date(new Date().getTime() - (60 * 60 * 1000)); - - // const query = ` - // SELECT - // SUM(entry.shares) AS difficultySum - // FROM - // client_statistics_entity AS entry - // WHERE - // entry.address = $1 AND entry.time > ${oneHour} - // `; - - // const result = await this.clientStatisticsRepository.query(query, [address]); - - // const difficultySum = result[0].difficultySum; - - // return (difficultySum * 4294967296) / (600); - - // } public async getChartDataForAddress(address: string) { diff --git a/src/ORM/client/client.entity.ts b/src/ORM/client/client.entity.ts index ba70650..921b674 100644 --- a/src/ORM/client/client.entity.ts +++ b/src/ORM/client/client.entity.ts @@ -14,6 +14,7 @@ export class ClientEntity extends TrackedEntity { @PrimaryColumn({ length: 64, type: 'varchar' }) clientName: string; + @Index() @PrimaryColumn({ length: 8, type: 'varchar' }) sessionId: string;