fix: normalize dimension key ordering for consistent grouping

Products with identical dimensions in different order (e.g. 29x10x15 vs 10x29x15) are now grouped together by sorting dimension values into a canonical form.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Christian Vidal Wolf
2026-04-07 10:37:16 +02:00
co-authored by Claude Sonnet 4.6
parent 16de3b3a6e
commit efbcd952b7
+5 -1
View File
@@ -42,7 +42,11 @@ export function DimensionsView({ data, headers, onEdit, onSaveRow, onCaptureStat
const il = String(row[COLUMNS.INNER_L] || '0').trim();
const ih = String(row[COLUMNS.INNER_H] || '0').trim();
const key = `${il}x${iw}x${ih}`;
// Normalize key by sorting dimension values so different orderings
// (e.g. "29x10x15" vs "10x29x15") are treated as the same group
const sortedDims = [parseFloat(il) || 0, parseFloat(iw) || 0, parseFloat(ih) || 0]
.sort((a, b) => a - b);
const key = sortedDims.join('x');
if (!groupMap.has(key)) {
groupMap.set(key, []);
}