fixed negative percents of freshness
This commit is contained in:
		@@ -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)}%"
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user