diff --git a/cope2n-fe/src/components/report-detail/report-table.tsx b/cope2n-fe/src/components/report-detail/report-table.tsx
index 66bfa6a..c59099d 100644
--- a/cope2n-fe/src/components/report-detail/report-table.tsx
+++ b/cope2n-fe/src/components/report-detail/report-table.tsx
@@ -5,7 +5,7 @@ import { useReportList } from 'queries/report';
import React, { useState } from 'react';
import { useNavigate } from 'react-router-dom';
import { downloadReport } from 'request/report';
-import { formatPercent, ensureMin, ensureMax } from 'utils/metric-format';
+import { formatPercent, ensureMin, ensureMax, formatNumber } from 'utils/metric-format';
import { datetimeStrToDate } from 'utils/time';
@@ -125,7 +125,7 @@ const ReportTable: React.FC = () => {
const isAbnormal = ensureMin(record['IMEI Acc'], 0.95);
return (
- {formatPercent(Number(record['IMEI Acc']))}
+ {formatPercent(record['IMEI Acc'])}
);
},
@@ -138,20 +138,20 @@ const ReportTable: React.FC = () => {
const isAbnormal = ensureMin(record['Avg. Accuracy'], 0.95);
return (
- {formatPercent(Number(record['Avg. Accuracy']))}
+ {formatPercent(record['Avg. Accuracy'])}
);
},
},
{
- title: 'Avg. OCR Processing Time',
+ title: 'Avg. OCR Processing Time (ms)',
dataIndex: 'Avg. OCR Processing Time',
key: 'Avg. OCR Processing Time',
render: (_, record) => {
const isAbnormal = ensureMax(record['Avg. OCR Processing Time'], 2);
return (
- {Number(record['Avg. OCR Processing Time'])?.toFixed(2)}
+ {formatNumber(record['Avg. OCR Processing Time'], 1)}
);
},
diff --git a/cope2n-fe/src/utils/metric-format.ts b/cope2n-fe/src/utils/metric-format.ts
index 02f290e..bcf9fd0 100644
--- a/cope2n-fe/src/utils/metric-format.ts
+++ b/cope2n-fe/src/utils/metric-format.ts
@@ -8,6 +8,13 @@ export const formatPercent = (value: any, floatingPoint: number = 1, maskZero: b
return value.toFixed(floatingPoint);
};
+export const formatNumber = (value: any, floatingPoint: number = 1, maskZero: boolean = false) => {
+ if (value === null || value === undefined || (value === 0 && maskZero)) {
+ return '-';
+ }
+ return value.toFixed(floatingPoint);
+};
+
export const ensureMin = (
value: number,
min: number,