From 26d2b6b1db719db01bd54c9beabb5add820241ee Mon Sep 17 00:00:00 2001 From: Dayowe Date: Thu, 26 Jun 2025 15:17:13 +0200 Subject: [PATCH] Update daily food amount with proper units --- iframe.html | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/iframe.html b/iframe.html index cd287eb..dbd8103 100644 --- a/iframe.html +++ b/iframe.html @@ -2888,15 +2888,14 @@ return; } - // Update daily food results (total) - dailyFoodValue.textContent = this.formatNumber(totalDailyGrams, 1) + ' g/day'; + // Update daily food results (total) - will be updated with proper units later dailyFoodResults.style.display = 'block'; // Update per-food breakdown if (foodBreakdownList && foodBreakdowns.length > 1) { const breakdownHTML = foodBreakdowns.map(breakdown => { const valueContent = breakdown.hasEnergyContent - ? `${this.formatNumber(breakdown.dailyGrams, 1)} g/day` + ? `${this.formatNumber(this.convertUnits(breakdown.dailyGrams, unit), decimals)} ${unitLabel}/day` : `⚠️`; return ` @@ -2917,6 +2916,10 @@ const unitLabel = unit === 'g' ? 'g' : unit === 'kg' ? 'kg' : unit === 'oz' ? 'oz' : 'lb'; const decimals = unit === 'g' ? 0 : unit === 'kg' ? 2 : 1; + // Update daily food value with correct units + const convertedDailyTotal = this.convertUnits(totalDailyGrams, unit); + dailyFoodValue.textContent = this.formatNumber(convertedDailyTotal, decimals) + ` ${unitLabel}/day`; + // Build HTML for individual food amounts const foodAmountsHTML = foodBreakdowns.map(breakdown => { const lockIndicator = breakdown.isLocked ? '🔒' : '';