This commit is contained in:
Ansel-Hong 2022-10-15 23:39:58 -04:00
parent 82c84e97b5
commit f1484dc01f

View file

@ -12,9 +12,9 @@ function FoodMeter({percentage}) {
const wasted = useContext(RecipeList).wastedIngredients;
const total = useContext(RecipeList).totalIngredients;
var percentageupdated = (total-wasted)/total;
var percentageupdated = Math.round(100* ((total-wasted)/total))/100;
useEffect(() => {
percentageupdated = (total-wasted)/total;
percentageupdated = Math.round(100* ((total-wasted)/total))/100;
console.log("percentage waste", percentageupdated);
}, [wasted, total]);