fixed parser behaviour on null net weight

This commit is contained in:
leca 2024-10-20 17:14:32 +03:00
parent 9b9946b280
commit 60aa1973b1
1 changed files with 5 additions and 2 deletions

View File

@ -13,8 +13,9 @@ class Parser constructor() {
val found = foundByRegex.groupValues[0] val found = foundByRegex.groupValues[0]
text = text.replace(found, "") text = text.replace(found, "")
netWeight = stripNetWeight(found) netWeight = stripNetWeight(found)
// }
return Triple(text, netWeight, found) return Triple(text, netWeight, found)
} else {
return Triple(text, 0.0, "")
} }
} }
return Triple("", 0.0, "") return Triple("", 0.0, "")
@ -40,7 +41,9 @@ class Parser constructor() {
"мл" -> { 3 } "мл" -> { 3 }
"шт" -> { 4 } "шт" -> { 4 }
else -> { -1 } else -> {
4
}
} }
return AbstractProduct(0, "", name, netWeight, "", 0, unitNumber) return AbstractProduct(0, "", name, netWeight, "", 0, unitNumber)