From 185b2ec163fc64276d32a53036b875aa02d1eee5 Mon Sep 17 00:00:00 2001 From: jtricerolph Date: Tue, 21 Jul 2026 18:17:42 +0000 Subject: [PATCH] Fall back to DOW averages for dry/wet when spend settings not configured Covers model returns data (covers * spend) but if resos spend settings are absent the result is zero, which previously bypassed the DOW fallback. Now fall back to DOW when the covers-based dry or wet is zero. Co-Authored-By: Claude Sonnet 4.6 --- backend/api/public.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/backend/api/public.py b/backend/api/public.py index 9faef9a..689f9b6 100644 --- a/backend/api/public.py +++ b/backend/api/public.py @@ -483,6 +483,14 @@ async def get_revenue_forecast( lunch_forecast * get_spend_by_period('lunch', 'wet') + dinner_forecast * get_spend_by_period('dinner', 'wet') ) + # If spend settings aren't configured, covers * 0 = 0 — fall back to DOW + dow = current.isoweekday() + if dry_forecast == 0: + dry_otb = 0 + dry_forecast = dow_dry.get(dow, 0) + if wet_forecast == 0: + wet_otb = 0 + wet_forecast = dow_wet.get(dow, 0) else: # No covers data — fall back to DOW average from recent 8 weeks dow = current.isoweekday() # 1=Mon … 7=Sun