mirror of
https://github.com/benjamin-wilson/public-pool.git
synced 2026-09-29 09:05:06 -07:00
best diff on dashboard
This commit is contained in:
@@ -45,6 +45,14 @@ export class ClientService {
|
|||||||
return await this.clientRepository.count();
|
return await this.clientRepository.count();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public async getBestDiff(address: string) {
|
||||||
|
const res = await this.clientRepository.createQueryBuilder('client')
|
||||||
|
.select('MAX(client.bestDifficulty)', 'bestDifficulty')
|
||||||
|
.where('client.address = :address', { address })
|
||||||
|
.withDeleted()
|
||||||
|
.getRawOne();
|
||||||
|
return res?.bestDifficulty;
|
||||||
|
}
|
||||||
public async getByAddress(address: string): Promise<ClientEntity[]> {
|
public async getByAddress(address: string): Promise<ClientEntity[]> {
|
||||||
return await this.clientRepository.find({
|
return await this.clientRepository.find({
|
||||||
where: {
|
where: {
|
||||||
|
|||||||
@@ -20,7 +20,10 @@ export class ClientController {
|
|||||||
|
|
||||||
const chartData = await this.clientStatisticsService.getChartDataForAddress(address);
|
const chartData = await this.clientStatisticsService.getChartDataForAddress(address);
|
||||||
|
|
||||||
|
const bestDifficulty = await this.clientService.getBestDiff(address);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
bestDifficulty,
|
||||||
workersCount: workers.length,
|
workersCount: workers.length,
|
||||||
workers: await Promise.all(
|
workers: await Promise.all(
|
||||||
workers.map(async (worker) => {
|
workers.map(async (worker) => {
|
||||||
|
|||||||
Reference in New Issue
Block a user