Fix carotene missing from food query, add fish oil field, full nutrient SELECT

- getFoodForDate: added p.phosphorus_mg, p.carotene_mcg (were missing)
- searchProducts: added carotene, selenium, zinc, copper, folate, D, K, B6, B12
- Supplement form: "Рыбий жир (мг)" field for total capsule weight
- Omega fields relabeled: "в т.ч." prefix to show they're part of fish oil

Carrot (12000 mcg carotene) was showing 0% because carotene_mcg
was not in the getFoodForDate SELECT.
This commit is contained in:
4aiman 2026-05-29 18:00:02 +03:00
commit cbac8d5d7b
2 changed files with 9 additions and 4 deletions

View file

@ -112,7 +112,9 @@ async function searchProducts(query, limit) {
protein_per_100g, fat_per_100g, carbs_per_100g, fiber_per_100g,
composition, nutrients_guessed,
vit_a_mcg, vit_c_mg, vit_b1_mg, vit_b2_mg, vit_b3_mg, vit_e_mg,
calcium_mg, iron_mg, magnesium_mg, potassium_mg, sodium_mg, phosphorus_mg
calcium_mg, iron_mg, magnesium_mg, potassium_mg, sodium_mg, phosphorus_mg,
carotene_mcg, selenium_mcg, zinc_mg, copper_mg, folate_mcg,
vit_d_mcg, vit_k_mcg, vit_b6_mg, vit_b12_mcg
FROM products
WHERE name_lower LIKE ?1
GROUP BY COALESCE(store_id, id)
@ -361,6 +363,7 @@ async function getFoodForDate(date) {
p.vit_b12_mcg, p.folate_mcg,
p.calcium_mg, p.iron_mg, p.magnesium_mg, p.zinc_mg, p.copper_mg,
p.selenium_mcg, p.potassium_mg, p.sodium_mg,
p.phosphorus_mg, p.carotene_mcg,
r.name as recipe_name,
su.name as unit_name, su.name_short as unit_short
FROM food_log fl
@ -1128,6 +1131,7 @@ async function runMigrations() {
await addSuppCol("lutein_mg", "REAL"); // лютеин — no RDI
await addSuppCol("lycopene_mg", "REAL"); // ликопин — no RDI
await addSuppCol("carotene_mcg", "REAL"); // бета-каротин
await addSuppCol("fish_oil_mg", "REAL"); // рыбий жир (общий объём)
await addSuppCol("omega3_mg", "REAL"); // омега-3 общая
await addSuppCol("epa_mg", "REAL"); // EPA (эйкозапентаеновая)
await addSuppCol("dha_mg", "REAL"); // DHA (докозагексаеновая)

View file

@ -3308,9 +3308,10 @@ const MICRO_FIELDS = [
{ key: "manganese_mg", label: "Марганец (мг)" },
{ key: "molybdenum_mcg", label: "Молибден (мкг)" },
{ key: "carotene_mcg", label: "Бета-каротин (мкг)" },
{ key: "omega3_mg", label: "Омега-3 общая (мг)" },
{ key: "epa_mg", label: "EPA (мг)" },
{ key: "dha_mg", label: "DHA (мг)" },
{ key: "fish_oil_mg", label: "Рыбий жир (мг)" },
{ key: "omega3_mg", label: "в т.ч. Омега-3 (мг)" },
{ key: "epa_mg", label: "в т.ч. EPA (мг)" },
{ key: "dha_mg", label: "в т.ч. DHA (мг)" },
{ key: "omega6_mg", label: "Омега-6 (мг)" },
{ key: "omega9_mg", label: "Омега-9 (мг)" },
{ key: "silicon_mg", label: "Кремний (мг)" },