Skip to content

Add fallback behavior for cities with insufficient recent submissions #87

@timothyfroehlich

Description

@timothyfroehlich

Problem

When adding a city with !add city Philadelphia, the bot only looks for submissions in the past 24 hours. If no submissions are found in that timeframe, it shows "ℹ️ No recent submissions found" and stops there.

Expected Behavior

If fewer than 5 submissions are found in the past day, the bot should fall back to showing the 5 most recent submissions regardless of date.

Current Behavior

  • Bot only searches past 24 hours using min_date_of_submission=yesterday
  • If no recent submissions found, shows "no recent submissions" message
  • No fallback to older submissions

Root Cause

The issue is in src/notifier.py (lines 46-99) and src/api.py (lines 171-194):

  1. fetch_submissions_for_coordinates() uses date filtering to only get past 24 hours
  2. No secondary API call to fetch older submissions when recent ones are insufficient

Proposed Solution

  1. After fetching recent submissions (past 24 hours), check if count < 5
  2. If insufficient, make a second API call without date filtering to get older submissions
  3. Combine recent + older submissions to reach 5 total
  4. Update messages to indicate mixed timeframes if needed

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions