From cbac8d5d7b7597e2f2c7f14292feb7e03c2b2968 Mon Sep 17 00:00:00 2001 From: 4aiman Date: Fri, 29 May 2026 18:00:02 +0300 Subject: [PATCH] Fix carotene missing from food query, add fish oil field, full nutrient SELECT MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 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. --- frontend/js/db.js | 6 +++++- frontend/js/main.js | 7 ++++--- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/frontend/js/db.js b/frontend/js/db.js index f82eae3..2d63ffa 100644 --- a/frontend/js/db.js +++ b/frontend/js/db.js @@ -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 (докозагексаеновая) diff --git a/frontend/js/main.js b/frontend/js/main.js index 7920d2a..a7dba78 100644 --- a/frontend/js/main.js +++ b/frontend/js/main.js @@ -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: "Кремний (мг)" },