Atualização automática - 2026-06-24 10:36:19
This commit is contained in:
@@ -5,7 +5,8 @@ import { ReportData, Standard, ComplianceItem } from '../types';
|
||||
*/
|
||||
function extractNumber(val: string): number | null {
|
||||
if (!val) return null;
|
||||
const match = val.match(/-?\d+(\.\d+)?/);
|
||||
const cleanVal = val.replace(/,/g, '.');
|
||||
const match = cleanVal.match(/-?\d+(\.\d+)?/);
|
||||
return match ? parseFloat(match[0]) : null;
|
||||
}
|
||||
|
||||
@@ -15,7 +16,16 @@ function extractNumber(val: string): number | null {
|
||||
*/
|
||||
function parseThickness(productDesc: string): number {
|
||||
if (!productDesc) return 0;
|
||||
const match = productDesc.match(/(\d+(\.\d+)?)\s*(mm)/i);
|
||||
|
||||
const cleanDesc = productDesc.replace(/,/g, '.');
|
||||
|
||||
// Try to find the pattern "num x num x num" (Thickness x Width x Length)
|
||||
const matchDimensions = cleanDesc.match(/(\d+(?:\.\d+)?)\s*(?:x|X|\*)\s*\d+(?:\.\d+)?\s*(?:x|X|\*)\s*\d+(?:\.\d+)?/);
|
||||
if (matchDimensions) {
|
||||
return parseFloat(matchDimensions[1]);
|
||||
}
|
||||
|
||||
const match = cleanDesc.match(/(\d+(\.\d+)?)\s*(mm)/i);
|
||||
if (match) return parseFloat(match[1]);
|
||||
return 0; // Default or unknown
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user