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 <noreply@anthropic.com>
This commit is contained in:
jtricerolph 2026-07-21 18:17:42 +00:00
parent ca75037e39
commit 185b2ec163

View file

@ -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