Compare commits

..

2 Commits

Author SHA1 Message Date
Nils-Johan Gynther 6503d29801 Merge branch 'main' of ssh://gitea.gynther.se:2222/nilsjohan/recipe-app 2026-05-03 08:14:39 +02:00
Nils-Johan Gynther d4769519c2 fix(receipt-import): correct regex for single pack extraction to handle unit formatting 2026-05-03 08:14:35 +02:00
@@ -81,7 +81,7 @@ function inferPackageDebugFromRawName(rawName: string): {
}
// e.g. "5dl", "1,5l"
const singlePack = /(\d+(?:[\.,]\d+)?)\s*(ml|cl|dl|l|g|kg)\b/i.exec(normalized);
const singlePack = /(\d+(?:[\.,]\d+)?)\s*(ml|cl|dl|l|g|kg)\b/i.exec(normalized.replace(/([\d.,]+)(ml|cl|dl|l|g|kg)\b/i, '$1 $2'));
if (singlePack) {
const qty = Number.parseFloat(singlePack[1].replace(',', '.'));
const unit = singlePack[2].toLowerCase();