Show all values
This commit is contained in:
parent
b3fd8c22c9
commit
dc9f7c00d6
@ -125,8 +125,7 @@ const ReportTable: React.FC = () => {
|
|||||||
const isAbnormal = ensureMin(record['IMEI Acc'], 0.95);
|
const isAbnormal = ensureMin(record['IMEI Acc'], 0.95);
|
||||||
return (
|
return (
|
||||||
<span style={{ color: isAbnormal ? 'red' : '' }}>
|
<span style={{ color: isAbnormal ? 'red' : '' }}>
|
||||||
{record['IMEI Acc'] &&
|
{formatPercent(Number(record['IMEI Acc']))}
|
||||||
formatPercent(Number(record['IMEI Acc']))}
|
|
||||||
</span>
|
</span>
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
@ -139,8 +138,7 @@ const ReportTable: React.FC = () => {
|
|||||||
const isAbnormal = ensureMin(record['Avg. Accuracy'], 0.95);
|
const isAbnormal = ensureMin(record['Avg. Accuracy'], 0.95);
|
||||||
return (
|
return (
|
||||||
<span style={{ color: isAbnormal ? 'red' : '' }}>
|
<span style={{ color: isAbnormal ? 'red' : '' }}>
|
||||||
{record['Avg. Accuracy'] &&
|
{formatPercent(Number(record['Avg. Accuracy']))}
|
||||||
formatPercent(Number(record['Avg. Accuracy']))}
|
|
||||||
</span>
|
</span>
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
@ -153,8 +151,7 @@ const ReportTable: React.FC = () => {
|
|||||||
const isAbnormal = ensureMax(record['Avg. OCR Processing Time'], 2);
|
const isAbnormal = ensureMax(record['Avg. OCR Processing Time'], 2);
|
||||||
return (
|
return (
|
||||||
<span style={{ color: isAbnormal ? 'red' : '' }}>
|
<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>
|
</span>
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
export const formatPercent = (value: number, floatingPoint: number = 1) => {
|
export const formatPercent = (value: any, floatingPoint: number = 1, maskZero: boolean = false) => {
|
||||||
if (value === null || value === undefined) {
|
if (value === null || value === undefined || (value === 0 && maskZero)) {
|
||||||
return '-';
|
return '-';
|
||||||
}
|
}
|
||||||
if (value < 100.0) {
|
if (value < 100.0) {
|
||||||
@ -13,6 +13,7 @@ export const ensureMin = (
|
|||||||
min: number,
|
min: number,
|
||||||
skipZero: boolean = true,
|
skipZero: boolean = true,
|
||||||
) => {
|
) => {
|
||||||
|
if (formatPercent(value) == '-') return false;
|
||||||
if (skipZero && value === 0) {
|
if (skipZero && value === 0) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -27,6 +28,7 @@ export const ensureMax = (
|
|||||||
max: number,
|
max: number,
|
||||||
skipZero: boolean = true,
|
skipZero: boolean = true,
|
||||||
) => {
|
) => {
|
||||||
|
if (formatPercent(value) == '-') return false;
|
||||||
if (skipZero && value === 0) {
|
if (skipZero && value === 0) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user