Skip to content

Commit d17bea9

Browse files
up
2 parents 86dc8cd + 3069d4d commit d17bea9

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

src/common/dashboard/interfaces/dashboard.service.interface.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,6 @@ export interface IDashboardService {
1919
month,
2020
year,
2121
}: IDashboardStartAndEnd): Promise<IDashboardStartAndEndDate>;
22+
23+
getPercentage(value: number, total: number): Promise<number>;
2224
}

src/common/dashboard/services/dashboard.service.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,13 @@ import {
66
} from 'src/common/dashboard/interfaces/dashboard.interface';
77
import { IDashboardService } from 'src/common/dashboard/interfaces/dashboard.service.interface';
88
import { HelperDateService } from 'src/common/helper/services/helper.date.service';
9+
import { HelperNumberService } from 'src/common/helper/services/helper.number.service';
910

1011
export class DashboardService implements IDashboardService {
11-
constructor(private readonly helperDateService: HelperDateService) {}
12+
constructor(
13+
private readonly helperDateService: HelperDateService,
14+
private readonly helperNumberService: HelperNumberService
15+
) {}
1216

1317
async getStartAndEndDate(
1418
date: DashboardDto
@@ -70,4 +74,8 @@ export class DashboardService implements IDashboardService {
7074
endDate,
7175
};
7276
}
77+
78+
async getPercentage(value: number, total: number): Promise<number> {
79+
return this.helperNumberService.percent(value, total);
80+
}
7381
}

0 commit comments

Comments
 (0)