Atualização automática - 2026-06-24 10:36:19

This commit is contained in:
2026-06-24 10:36:19 +00:00
parent 4599398fb6
commit 570190c5f1
3 changed files with 125 additions and 7 deletions
+12 -2
View File
@@ -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
}