fixed parser behaviour on null net weight
This commit is contained in:
parent
9b9946b280
commit
60aa1973b1
|
@ -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)
|
||||||
|
|
Loading…
Reference in New Issue