fix(news): drop future-dated items at ingest, hide them in /api/news
wiseye.org public-affairs event listings carry pubDate 3-6 days ahead; with ORDER BY timestamp DESC they pinned the top of the feed for a week and made the news list look frozen. - PostgresPipeline drops items whose parsed publish date is >2h in the future, counts future_dated_dropped (stats + one INFO line per run). Unparseable dates keep the old behaviour (kept, timestamped now()). - GET /api/news filters timestamp > now() in the query while still returning timestamp IS NULL rows; limit/offset/domain/since unchanged. - docs/news.md documents the guard. - tests: pipeline drop/keep unit tests, API future-row exclusion + limit.
This commit is contained in:
parent
fdf5969e27
commit
c42d375d6c
5 changed files with 176 additions and 3 deletions
|
|
@ -1207,7 +1207,12 @@ async def list_news(
|
|||
):
|
||||
"""Most recent scraped news articles (newest first)."""
|
||||
async with async_session() as session:
|
||||
stmt = select(articles).order_by(
|
||||
stmt = select(articles).where(
|
||||
or_(
|
||||
articles.c.timestamp.is_(None),
|
||||
articles.c.timestamp <= func.now(),
|
||||
)
|
||||
).order_by(
|
||||
articles.c.timestamp.desc().nullslast()
|
||||
)
|
||||
if domain:
|
||||
|
|
|
|||
Loading…
Reference in a new issue