mirror of
https://github.com/benjamin-wilson/public-pool.git
synced 2026-09-29 09:05:06 -07:00
index, dead code
This commit is contained in:
@@ -56,84 +56,7 @@ export class ClientStatisticsService {
|
|||||||
.execute();
|
.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) {
|
public async getChartDataForAddress(address: string) {
|
||||||
|
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ export class ClientEntity extends TrackedEntity {
|
|||||||
@PrimaryColumn({ length: 64, type: 'varchar' })
|
@PrimaryColumn({ length: 64, type: 'varchar' })
|
||||||
clientName: string;
|
clientName: string;
|
||||||
|
|
||||||
|
@Index()
|
||||||
@PrimaryColumn({ length: 8, type: 'varchar' })
|
@PrimaryColumn({ length: 8, type: 'varchar' })
|
||||||
sessionId: string;
|
sessionId: string;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user