···10431043 const { total, kcal } = calculateRDA(catWeight, activity, coef);
10441044 this.state.calculatedRDA = total;
10451045 this.state.kcal = kcal;
10461046+10471047+ // Filter out products containing any unwanted ingredients
10481048+ if (this.state.unwantedIngredients.length > 0) {
10491049+ this.state.recommendedProducts =
10501050+ this.state.recommendedProducts.filter((product) => {
10511051+ const ingredients = product.customFields?.Ingredients ?? [];
10521052+ return !ingredients.some((ing) =>
10531053+ this.state.unwantedIngredients.includes(ing),
10541054+ );
10551055+ });
10561056+ }
10571057+10461058 // need to calculate grams for each recommended product based on kcal and product calorie density - each product has a custom field called CALORIE per Product and another called Weight of product which is in grams - so we can calculate calories per kg for each product and then calculate grams needed to meet the RDA kcal
10471059 for (const product of this.state.recommendedProducts) {
10481060 const calsPerProduct = Number(