fixed negative percents of freshness
This commit is contained in:
parent
244ef95a99
commit
cba0e8594f
|
@ -103,7 +103,7 @@ class ProductView: LinearLayout {
|
|||
productCategoryView.text = DBStorageController(activity).getCategoryNameById(DBStorageController(activity).readableDatabase, linkedAbstractProduct.category)
|
||||
productLifeSpan.text = "${SimpleDateFormat("dd.MM.yyyy").format(Date(product.dateOfProduction*1000))}-${SimpleDateFormat("dd.MM.yyyy").format(Date(product.dateOfExpiry*1000))}"
|
||||
productFreshnessTextView.text =
|
||||
if (product.freshness == Double.NEGATIVE_INFINITY || product.freshness == Double.POSITIVE_INFINITY) {
|
||||
if (product.freshness == Double.NEGATIVE_INFINITY || product.freshness == Double.POSITIVE_INFINITY || product.freshness < 0) {
|
||||
"Expired"
|
||||
} else {
|
||||
"${DecimalFormat("#.#").format(product.freshness*100)}%"
|
||||
|
|
Loading…
Reference in New Issue