Merge pull request from SDSRV-IDP/fix/fe-issues

Show all values
This commit is contained in:
Đỗ Xuân Tân 2024-03-07 16:11:35 +07:00 committed by GitHub Enterprise
commit b016b7c45e
2 changed files with 7 additions and 8 deletions
cope2n-fe/src
components/report-detail
utils

View File

@ -125,8 +125,7 @@ const ReportTable: React.FC = () => {
const isAbnormal = ensureMin(record['IMEI Acc'], 0.95);
return (
<span style={{ color: isAbnormal ? 'red' : '' }}>
{record['IMEI Acc'] &&
formatPercent(Number(record['IMEI Acc']))}
{formatPercent(Number(record['IMEI Acc']))}
</span>
);
},
@ -139,8 +138,7 @@ const ReportTable: React.FC = () => {
const isAbnormal = ensureMin(record['Avg. Accuracy'], 0.95);
return (
<span style={{ color: isAbnormal ? 'red' : '' }}>
{record['Avg. Accuracy'] &&
formatPercent(Number(record['Avg. Accuracy']))}
{formatPercent(Number(record['Avg. Accuracy']))}
</span>
);
},
@ -153,8 +151,7 @@ const ReportTable: React.FC = () => {
const isAbnormal = ensureMax(record['Avg. OCR Processing Time'], 2);
return (
<span style={{ color: isAbnormal ? 'red' : '' }}>
{record['Avg. OCR Processing Time'] &&
Number(record['Avg. OCR Processing Time'])?.toFixed(2)}
{Number(record['Avg. OCR Processing Time'])?.toFixed(2)}
</span>
);
},

View File

@ -1,5 +1,5 @@
export const formatPercent = (value: number, floatingPoint: number = 1) => {
if (value === null || value === undefined) {
export const formatPercent = (value: any, floatingPoint: number = 1, maskZero: boolean = false) => {
if (value === null || value === undefined || (value === 0 && maskZero)) {
return '-';
}
if (value < 100.0) {
@ -13,6 +13,7 @@ export const ensureMin = (
min: number,
skipZero: boolean = true,
) => {
if (formatPercent(value) == '-') return false;
if (skipZero && value === 0) {
return false;
}
@ -27,6 +28,7 @@ export const ensureMax = (
max: number,
skipZero: boolean = true,
) => {
if (formatPercent(value) == '-') return false;
if (skipZero && value === 0) {
return false;
}