Refresh visible news risk ratings after analysis
Development CI / check-and-build (push) Successful in 1m29s
GitHub Git mirror / mirror (push) Successful in 6s
Development CI / deploy-development (push) Failing after 5s

Poll only visible news IDs and update ratings for matching revisions without replacing the feed, scrolling, or clearing pending-news notifications. Bind refresh results to the page and session, and cover stale responses and bounded ID queries.
This commit is contained in:
eezd committed 2026-10-30 18:41:03 +08:00
1 parent 4f43ca8b57
commit 91bc65df75
7 files changed
+101 -3

No files matched your search

+3
View File
@@ -113,8 +113,11 @@ async def list_news(
end: datetime | None = None,
page: Annotated[int, Query(ge=1)] = 1,
limit: Annotated[int, Query(ge=1, le=100)] = 30,
ids: Annotated[list[int] | None, Query(min_length=1, max_length=100)] = None,
) -> ApiResponse[NewsPage]:
conditions = news_filters(source, q, start, end)
if ids is not None:
conditions.append(NewsItem.id.in_(ids))
total = await session.scalar(select(func.count()).select_from(NewsItem).where(*conditions))
rows = (await session.execute(
select(NewsItem, func.left(NewsItem.content_text, EXCERPT_LENGTH).label("excerpt"), RiskAnalysis)