mirror of
https://github.com/benjamin-wilson/public-pool.git
synced 2026-09-29 17:15:03 -07:00
cleaning
This commit is contained in:
+24
-5
@@ -26,6 +26,7 @@ export class AppController {
|
||||
|
||||
const workers = await this.clientService.getByAddress(address);
|
||||
|
||||
const chartData = await this.clientStatisticsService.getChartDataForAddress(address);
|
||||
|
||||
return {
|
||||
workersCount: workers.length,
|
||||
@@ -35,27 +36,45 @@ export class AppController {
|
||||
sessionId: worker.sessionId,
|
||||
name: worker.clientName,
|
||||
bestDifficulty: Math.floor(worker.bestDifficulty),
|
||||
hashRate: Math.floor(await this.clientStatisticsService.getHashRate(worker.sessionId)),
|
||||
hashRate: Math.floor(await this.clientStatisticsService.getHashRateForSession(worker.address, worker.clientName, worker.sessionId)),
|
||||
startTime: worker.startTime
|
||||
};
|
||||
})
|
||||
)
|
||||
),
|
||||
chartData
|
||||
}
|
||||
}
|
||||
|
||||
@Get('client/:address/:workerName')
|
||||
async getWorkerGroupInfo(@Param('address') address: string, @Param('address') workerName: string) {
|
||||
async getWorkerGroupInfo(@Param('address') address: string, @Param('workerName') workerName: string) {
|
||||
|
||||
const workers = await this.clientService.getByName(address, workerName);
|
||||
|
||||
const bestDifficulty = workers.reduce((pre, cur, idx, arr) => {
|
||||
if (cur.bestDifficulty > pre) {
|
||||
return cur.bestDifficulty;
|
||||
}
|
||||
return pre;
|
||||
}, 0);
|
||||
|
||||
const chartData = await this.clientStatisticsService.getChartDataForGroup(address, workerName);
|
||||
return {
|
||||
|
||||
name: workerName,
|
||||
bestDifficulty: Math.floor(bestDifficulty),
|
||||
chartData: chartData,
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@Get('client/:address/:workerName/:sessionId')
|
||||
async getWorkerInfo(@Param('address') address: string, @Param('workerName') workerName: string, @Param('sessionId') sessionId: string) {
|
||||
|
||||
const worker = await this.clientService.getById(address, workerName, sessionId);
|
||||
const worker = await this.clientService.getBySessionId(address, workerName, sessionId);
|
||||
if (worker == null) {
|
||||
return new NotFoundException();
|
||||
}
|
||||
const chartData = await this.clientStatisticsService.getChartData(sessionId);
|
||||
const chartData = await this.clientStatisticsService.getChartDataForSession(worker.address, worker.clientName, worker.sessionId);
|
||||
|
||||
return {
|
||||
sessionId: worker.sessionId,
|
||||
|
||||
Reference in New Issue
Block a user