Update daily food amount with proper units
This commit is contained in:
parent
b552b5e88e
commit
26d2b6b1db
@ -2888,15 +2888,14 @@
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update daily food results (total)
|
// Update daily food results (total) - will be updated with proper units later
|
||||||
dailyFoodValue.textContent = this.formatNumber(totalDailyGrams, 1) + ' g/day';
|
|
||||||
dailyFoodResults.style.display = 'block';
|
dailyFoodResults.style.display = 'block';
|
||||||
|
|
||||||
// Update per-food breakdown
|
// Update per-food breakdown
|
||||||
if (foodBreakdownList && foodBreakdowns.length > 1) {
|
if (foodBreakdownList && foodBreakdowns.length > 1) {
|
||||||
const breakdownHTML = foodBreakdowns.map(breakdown => {
|
const breakdownHTML = foodBreakdowns.map(breakdown => {
|
||||||
const valueContent = breakdown.hasEnergyContent
|
const valueContent = breakdown.hasEnergyContent
|
||||||
? `${this.formatNumber(breakdown.dailyGrams, 1)} g/day`
|
? `${this.formatNumber(this.convertUnits(breakdown.dailyGrams, unit), decimals)} ${unitLabel}/day`
|
||||||
: `<span class="dog-calculator-warning" title="Enter energy content to calculate amount">⚠️</span>`;
|
: `<span class="dog-calculator-warning" title="Enter energy content to calculate amount">⚠️</span>`;
|
||||||
|
|
||||||
return `
|
return `
|
||||||
@ -2917,6 +2916,10 @@
|
|||||||
const unitLabel = unit === 'g' ? 'g' : unit === 'kg' ? 'kg' : unit === 'oz' ? 'oz' : 'lb';
|
const unitLabel = unit === 'g' ? 'g' : unit === 'kg' ? 'kg' : unit === 'oz' ? 'oz' : 'lb';
|
||||||
const decimals = unit === 'g' ? 0 : unit === 'kg' ? 2 : 1;
|
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
|
// Build HTML for individual food amounts
|
||||||
const foodAmountsHTML = foodBreakdowns.map(breakdown => {
|
const foodAmountsHTML = foodBreakdowns.map(breakdown => {
|
||||||
const lockIndicator = breakdown.isLocked ? '<span class="dog-calculator-lock-indicator">🔒</span>' : '';
|
const lockIndicator = breakdown.isLocked ? '<span class="dog-calculator-lock-indicator">🔒</span>' : '';
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user