fix(expiry): potato shelf life 14→30 days in pantry; add explicit rules for onion/garlic/carrot
This commit is contained in:
@@ -363,6 +363,10 @@ function estimateOpenedExpiryDaysPHP(string $name, string $category, string $loc
|
|||||||
if (preg_match('/\b(yogurt|yaourt|yoghurt)\b/', $n)) return 2;
|
if (preg_match('/\b(yogurt|yaourt|yoghurt)\b/', $n)) return 2;
|
||||||
if (preg_match('/\blatte\b/', $n)) return 1;
|
if (preg_match('/\blatte\b/', $n)) return 1;
|
||||||
if (preg_match('/\bformaggio\b/', $n)) return 2;
|
if (preg_match('/\bformaggio\b/', $n)) return 2;
|
||||||
|
// Root vegetables / tubers in pantry: sfusi in un sacchetto, durano 3-5 settimane
|
||||||
|
if (preg_match('/\b(patata|patate|tubero)\b/', $n)) return 30;
|
||||||
|
if (preg_match('/\b(cipolla|cipolle|aglio|scalogno|porro)\b/', $n)) return 30;
|
||||||
|
if (preg_match('/\b(carota|carote)\b/', $n)) return 14;
|
||||||
return 60; // generic pantry fallback
|
return 60; // generic pantry fallback
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+2
-2
@@ -1553,7 +1553,7 @@ function estimateExpiryDays(product, location) {
|
|||||||
else if (/carota|carote|zucchina|zucchine|peperoni|melanzane/.test(name)) days = 7;
|
else if (/carota|carote|zucchina|zucchine|peperoni|melanzane/.test(name)) days = 7;
|
||||||
else if (/broccoli|cavolfiore|cavolo|spinaci|bietola/.test(name)) days = 5;
|
else if (/broccoli|cavolfiore|cavolo|spinaci|bietola/.test(name)) days = 5;
|
||||||
else if (/cipolla|cipolle/.test(name)) days = 10;
|
else if (/cipolla|cipolle/.test(name)) days = 10;
|
||||||
else if (/patata|patate/.test(name)) days = 14;
|
else if (/patata|patate/.test(name)) days = 30; // whole tubers in a bag, pantry: 3-5 weeks
|
||||||
else if (/biscott|cracker|grissini|fette\s+biscott/.test(name)) days = 180;
|
else if (/biscott|cracker|grissini|fette\s+biscott/.test(name)) days = 180;
|
||||||
else if (/nutella|marmellata|miele/.test(name)) days = 365;
|
else if (/nutella|marmellata|miele/.test(name)) days = 365;
|
||||||
else if (/passata|pelati|pomodor/.test(name)) days = 730;
|
else if (/passata|pelati|pomodor/.test(name)) days = 730;
|
||||||
@@ -1573,7 +1573,7 @@ function estimateExpiryDays(product, location) {
|
|||||||
else if (/arancia|arance|agrumi|mandarini|limone|limoni/.test(name)) days = Math.max(days, 21);
|
else if (/arancia|arance|agrumi|mandarini|limone|limoni/.test(name)) days = Math.max(days, 21);
|
||||||
else if (/carota|carote/.test(name)) days = Math.max(days, 21);
|
else if (/carota|carote/.test(name)) days = Math.max(days, 21);
|
||||||
else if (/cipolla/.test(name)) days = Math.max(days, 14);
|
else if (/cipolla/.test(name)) days = Math.max(days, 14);
|
||||||
else if (/patata|patate/.test(name)) days = Math.max(days, 21);
|
else if (/patata|patate/.test(name)) days = Math.max(days, 30);
|
||||||
else if (/pera|pere/.test(name)) days = Math.max(days, 21);
|
else if (/pera|pere/.test(name)) days = Math.max(days, 21);
|
||||||
else if (/kiwi/.test(name)) days = Math.max(days, 28);
|
else if (/kiwi/.test(name)) days = Math.max(days, 28);
|
||||||
else if (/uva/.test(name)) days = Math.max(days, 14);
|
else if (/uva/.test(name)) days = Math.max(days, 14);
|
||||||
|
|||||||
Reference in New Issue
Block a user