feat: AI suggestions, smart shopping qty, shelf life fixes, UX polish
- bringSuggestItems(): Gemini AI for seasonal/complementary suggestions (6h cache) - renderSuggestions(): AI badge (🤖 AI) for AI-sourced items + CSS .priority-ai - smartShopping(): suggested_qty/unit/approx with package-aware tiers - autoSyncUrgencySpecs(): sync suggested quantities to Bring! spec field - estimateOpenedExpiryDays(): dairy-outside-fridge rules (panna 3d, yogurt 2d, latte 1d) - AI shelf-life upper bound tightened to max(rule×4, 30) days - Opened section: fix 0g display (remainderAmt >= 0.5 threshold, pkgSize guard) - guessCategoryFromName(): expanded with 50+ new patterns (uova, herbs, vegetables...) - Suggestions panel: excludes already-added Bring! items - Shopping list: no re-render while suggestions panel is open - Translations: remove duplicate 🍳 from dashboard.quick_recipe (all 3 langs) - Scale icon: always white via filter:brightness(0)invert(1) - opened_shelf_cache.json: remove 3 bad dairy entries (60d outside fridge)
This commit is contained in:
+7
-2
@@ -308,7 +308,12 @@ function estimateOpenedExpiryDaysPHP(string $name, string $category, string $loc
|
||||
if (preg_match('/\bpane\b/', $n)) return 4;
|
||||
// Specific jarred tomato sauce in pantry (opened, not refrigerated)
|
||||
if (preg_match('/salsa\s+di\s+(pomodoro|pronta)/', $n)) return 5;
|
||||
return 60; // generic pantry fallback (was 30, doubled)
|
||||
// Dairy opened outside fridge: bad very quickly at room temperature
|
||||
if (preg_match('/\bpanna\b/', $n)) return 3;
|
||||
if (preg_match('/\b(yogurt|yaourt|yoghurt)\b/', $n)) return 2;
|
||||
if (preg_match('/\blatte\b/', $n)) return 1;
|
||||
if (preg_match('/\bformaggio\b/', $n)) return 2;
|
||||
return 60; // generic pantry fallback
|
||||
}
|
||||
|
||||
// ── F: Fridge — short-life perishables ──────────────────────────────
|
||||
@@ -317,7 +322,7 @@ function estimateOpenedExpiryDaysPHP(string $name, string $category, string $loc
|
||||
// Long-life mountain/brand milks stored in pantry before use (UHT)
|
||||
if (preg_match('/latte.*(montagna|alta\s+qual|parmalat|granarolo|esselunga|conservaz|microfiltrat)/i', $n)) return 7;
|
||||
if (preg_match('/\blatte\b/', $n)) return 4;
|
||||
if (preg_match('/\byogurt\b/', $n)) return 5;
|
||||
if (preg_match('/\b(yogurt|yaourt|yoghurt)\b/', $n)) return 5;
|
||||
if (preg_match('/mozzarella|burrata|stracciatella/', $n)) return 3;
|
||||
if (preg_match('/philadelphia|spalmabile/', $n)) return 7;
|
||||
if (preg_match('/formaggio.*(fresco|ricotta|mascarpone|stracchino|crescenza)/', $n)) return 5;
|
||||
|
||||
Reference in New Issue
Block a user