Convert beta-carotene to vitamin A, remove from nutrient strip

12 mcg beta-carotene = 1 mcg retinol equivalent (vitamin A).
Carotene from food and supplements now adds to vit_a_mcg total.
Removed carotene_mcg from RDI table and NUTRIENT_LABELS —
no longer shows as separate "b-car 0%" chip misleading users.

Carrot 150g: 18000 mcg carotene / 12 = 1500 mcg vit A = 188% RDI.
Supplement field "Бета-каротин" kept in form for data entry.
This commit is contained in:
4aiman 2026-05-29 18:09:29 +03:00
commit b4b2914d00
2 changed files with 14 additions and 3 deletions

View file

@ -55,7 +55,7 @@ const RDI = {
phosphorus_mg: 800,
potassium_mg: 3500,
sodium_mg: 2400,
carotene_mcg: 5000, // бета-каротин (нет официальной нормы, ~5мг)
// carotene_mcg removed — auto-converted to vit_a_mcg (carotene/12)
};
window.BMR = { calculateBmr, getAge, estimateRealBmr, RDI };

View file

@ -3932,7 +3932,8 @@ const NUTRIENT_LABELS = {
iron_mg: "Fe", iodine_mg: "I", selenium_mcg: "Se",
molybdenum_mcg: "Mo", manganese_mg: "Mn", copper_mg: "Cu",
chromium_mg: "Cr", phosphorus_mg: "P", potassium_mg: "K+",
sodium_mg: "Na", carotene_mcg: "b-car",
sodium_mg: "Na",
// carotene_mcg not shown separately — auto-converted to vit A
};
// Build supplement micronutrient strip (existing horizontal chips on Today screen)
@ -3962,7 +3963,9 @@ function foodNutrientLine(f) {
if (pct >= 1) items.push(`${label} ${pct}%`);
};
check(f.vit_c_mg, RDI.vit_c_mg, "C");
check(f.vit_a_mcg, RDI.vit_a_mcg, "A");
// Vitamin A = retinol + carotene/12
const vitA = (f.vit_a_mcg || 0) + (f.carotene_mcg || 0) / 12;
check(vitA, RDI.vit_a_mcg, "A");
check(f.vit_b1_mg, RDI.vit_b1_mg, "B1");
check(f.vit_b2_mg, RDI.vit_b2_mg, "B2");
check(f.vit_b3_mg, RDI.vit_b3_mg, "B3");
@ -3999,6 +4002,10 @@ function calcDailyNutrients(food, suppTotals) {
totals[key] = (totals[key] || 0) + f[key] * factor;
}
}
// Convert beta-carotene → vitamin A (12 mcg carotene = 1 mcg retinol equivalent)
if (f.carotene_mcg) {
totals.vit_a_mcg = (totals.vit_a_mcg || 0) + (f.carotene_mcg * factor) / 12;
}
}
// From supplements
@ -4008,6 +4015,10 @@ function calcDailyNutrients(food, suppTotals) {
totals[key] = (totals[key] || 0) + suppTotals[key];
}
}
// Convert supplement beta-carotene → vitamin A
if (suppTotals.carotene_mcg) {
totals.vit_a_mcg = (totals.vit_a_mcg || 0) + suppTotals.carotene_mcg / 12;
}
}
// Build array sorted by %RDI ascending