Priorità verdura/frutta aperta in ricette + stime corrette
Stime opened (PHP+JS):
- Avocado -> 2d; fragole/banane/pesca/mango -> 2d
- Mela/pera/kiwi/ananas/melone/uva -> 3d
- Zucchina/melanzana/pomodoro/peperone -> 3d (era 7d)
- Broccolo/cavolfiore/sedano/finocchio -> 3d (era 7d)
- Cipolla/cipollotto/scalogno/porro -> 4d (era 7d)
- Carota -> 5d (era 7d); Aglio -> 10d
- Insalata/rucola/spinaci -> 2d (era 4d)
Recipe generator (index.php):
- SQL include i.opened_at
- getItemPriority: rileva opened_at su QUALSIASI unità (non solo conf)
- Elementi [APERTO] con scadenza <=5gg promossi in 'fortemente consigliati'
- Label '📦 PRODOTTI APERTI' aggiornata
- [APERTO] mostrato nel testo ingredienti del prompt AI
- Stesso fix nel contesto chat (opened_at + [APERTO] label)
DB migration: ricalcolate scadenze aperti con nuove stime
This commit is contained in:
+16
-6
@@ -447,15 +447,25 @@ function estimateOpenedExpiryDays(product, location) {
|
||||
if (/\b(pollo|tacchino|maiale|manzo|vitello|agnello)\b/.test(name)) return 2;
|
||||
if (/salmone|tonno\s+fresco|pesce(?!\s+in)/.test(name)) return 2;
|
||||
if (/\b(passata|pelati|polpa|sugo|salsa\s+di\s+pomodoro)\b/.test(name)) return 5;
|
||||
if (/insalata|rucola|spinaci|lattuga/.test(name)) return 4;
|
||||
if (/\b(succo|spremuta)\b/.test(name)) return 5;
|
||||
if (/\blimone\b/.test(name)) return 14;
|
||||
if (/insalata|rucola|spinaci|lattuga|crescione|germogli/.test(name)) return 2;
|
||||
if (/\b(succo|spremuta)\b/.test(name)) return 3;
|
||||
if (/\b(birra|beer)\b/.test(name)) return 3;
|
||||
if (/\bvino\b/.test(name)) return 5;
|
||||
if (/tonno\s+in\s+scatola|tonno\s+rio|sgombro\s+in/.test(name)) return 4;
|
||||
if (/\b(banana|banane|mela|pera|pesca|albicocca|ciliegia|uva|fragola|lampone|kiwi)\b/.test(name)) return 10;
|
||||
if (/\b(arancia|mandarino|pompelmo|clementina)\b/.test(name)) return 14;
|
||||
if (/\b(carota|zucchina|peperone|melanzana|broccolo|cavolfiore|sedano|finocchio)\b/.test(name)) return 7;
|
||||
// Fruit opened/cut in fridge
|
||||
if (/\bavocado\b/.test(name)) return 2;
|
||||
if (/\b(banana|banane|fragola|lampone|pesca|albicocca|ciliegia|mango|papaya)\b/.test(name)) return 2;
|
||||
if (/\b(mela|pera|nettarina|prugna|kiwi|ananas|uva|melone|anguria)\b/.test(name)) return 3;
|
||||
if (/\b(arancia|mandarino|pompelmo|clementina|limone)\b/.test(name)) return 3;
|
||||
// Vegetables opened/cut in fridge
|
||||
if (/\b(zucchina|zucchine|melanzana|pomodor)\b/.test(name)) return 3;
|
||||
if (/\b(peperone|peperoni)\b/.test(name)) return 3;
|
||||
if (/\b(broccolo|broccoli|cavolfiore|cavolo)\b/.test(name)) return 3;
|
||||
if (/\bsedano\b|\bfinocchio\b/.test(name)) return 3;
|
||||
if (/\b(cipolla|cipolle|cipollotto|scalogno|porro)\b/.test(name)) return 4;
|
||||
if (/\b(carota|carote)\b/.test(name)) return 5;
|
||||
if (/\b(patata|patate|tubero)\b/.test(name)) return 3;
|
||||
if (/\baglio\b/.test(name)) return 10;
|
||||
|
||||
// ── G: Fridge condiments ─────────────────────────────────────────────
|
||||
if (/maionese|mayo|mayon/.test(name)) return 90;
|
||||
|
||||
Reference in New Issue
Block a user