Skip to content
This repository was archived by the owner on Aug 29, 2025. It is now read-only.

Commit b2f24b2

Browse files
AI 사용량 반올림
1 parent 14f65ef commit b2f24b2

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

src/app/components/dashboard/dashboard.component.ts

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import { MatGridListModule } from '@angular/material/grid-list';
99
import { MatProgressBarModule } from '@angular/material/progress-bar';
1010
import { MatChipsModule } from '@angular/material/chips';
1111
import { AdminService, SystemStatus, UserStats } from '../../services/admin.service';
12+
import math
1213

1314
@Component({
1415
selector: 'app-dashboard',
@@ -20,7 +21,7 @@ import { AdminService, SystemStatus, UserStats } from '../../services/admin.serv
2021
MatIconModule,
2122
MatGridListModule,
2223
MatProgressBarModule,
23-
MatChipsModule
24+
MatChipsModule,
2425
],
2526
template: `
2627
<div class="dashboard-container p-6 bg-md-sys-color-surface min-h-screen">
@@ -136,18 +137,18 @@ import { AdminService, SystemStatus, UserStats } from '../../services/admin.serv
136137
<div *ngIf="aiUsage" class="space-y-4">
137138
<div class="grid grid-cols-2 gap-4">
138139
<div class="text-center p-4 bg-md-sys-color-primary-container rounded-xl">
139-
<div class="text-3xl font-bold text-md-sys-color-on-primary-container mb-1">{{ aiUsage.total_credits }}</div>
140+
<div class="text-3xl font-bold text-md-sys-color-on-primary-container mb-1">\${{ round(aiUsage.total_credits) }}</div>
140141
<div class="md-typescale-body-small text-md-sys-color-on-primary-container">충전된 크레딧</div>
141142
</div>
142143
<div class="text-center p-4 bg-md-sys-color-secondary-container rounded-xl">
143-
<div class="text-3xl font-bold text-md-sys-color-on-secondary-container mb-1">{{ aiUsage.total_usage }}</div>
144+
<div class="text-3xl font-bold text-md-sys-color-on-secondary-container mb-1">\${{ round(aiUsage.total_usage) }}</div>
144145
<div class="md-typescale-body-small text-md-sys-color-on-secondary-container">총 사용 크레딧</div>
145146
</div>
146147
</div>
147148
<div class="mt-4">
148149
<div class="flex justify-between items-center mb-2">
149150
<span class="md-typescale-body-small text-md-sys-color-on-surface-variant">사용량 추세</span>
150-
<span class="md-typescale-body-small text-md-sys-color-on-surface-variant">{{ aiUsage.total_usage }} 크레딧</span>
151+
<span class="md-typescale-body-small text-md-sys-color-on-surface-variant">\${{ round(aiUsage.total_usage) }} 크레딧</span>
151152
</div>
152153
<div class="w-full bg-md-sys-color-surface-container-high rounded-full h-2">
153154
<div class="bg-md-sys-color-primary h-2 rounded-full transition-all duration-300"
@@ -299,6 +300,10 @@ export class DashboardComponent implements OnInit {
299300
return this.systemStatus.loadavg * 100;
300301
}
301302

303+
round(value: number): number {
304+
return Math.round(value*100) / 100; // 소수점 둘째 자리까지 반올림
305+
}
306+
302307
formatDate(dateString: string): string {
303308
return new Date(dateString).toLocaleDateString('ko-KR');
304309
}

0 commit comments

Comments
 (0)