fix(bring): keep weekly depletion items auto-synced despite local purchased blocklist

- autoAddCriticalItems now bypasses _isBringPurchased for imminent items
  (days_left <= 7 and uses_per_month >= 3)
- prevents missing Bring additions for items predicted to finish within a week
  after temporary local blocklist entries
This commit is contained in:
dadaloop82
2026-04-19 09:10:39 +00:00
parent c115f83879
commit cedd97fd73
+5 -1
View File
@@ -6730,7 +6730,11 @@ async function autoAddCriticalItems() {
// - high: always (PHP already applies strict criteria for high urgency)
// - medium: when running out within 7 days (<1 week) for items used ≥3x/month
const toAdd = smartShoppingItems.filter(i => {
if (i.on_bring || _isBringPurchased(i.name, i.urgency)) return false;
const imminentWeek = (i.days_left ?? 999) <= 7 && (i.uses_per_month || 0) >= 3;
if (i.on_bring) return false;
// For imminent items, do not honor local "purchased" blocklist too aggressively.
// If they are predicted to finish within a week, keep Bring aligned automatically.
if (!imminentWeek && _isBringPurchased(i.name, i.urgency)) return false;
if (i.urgency === 'critical') return true;
if (i.urgency === 'high') return true;
if (i.urgency === 'medium' && (i.days_left ?? 999) <= 7 && (i.uses_per_month || 0) >= 3) return true;