|
44 | 44 | # AsyncMock / MagicMock for tests – imported early so helper can reference them |
45 | 45 | from unittest.mock import AsyncMock, MagicMock |
46 | 46 |
|
47 | | -from opentelemetry import trace |
48 | | -import time |
49 | | -from app.metrics import ASTRA_DB_QUERY_DURATION_SECONDS |
50 | 47 |
|
51 | 48 | # --------------------------------------------------------------------------- |
52 | 49 | # Constants & Regex Patterns |
@@ -514,12 +511,18 @@ async def list_latest_videos( |
514 | 511 | page_size: int, |
515 | 512 | db_table: Optional[AstraDBCollection] = None, |
516 | 513 | ) -> Tuple[List[VideoSummary], int]: |
| 514 | + """Return the newest *three* videos across all days for the home page row.""" |
| 515 | + |
| 516 | + # We only need a single row of 3 videos on the UI – cap the page size. |
| 517 | + effective_size = min(page_size, 3) |
| 518 | + |
517 | 519 | return await list_videos_with_query( |
518 | 520 | {}, |
519 | 521 | page, |
520 | | - page_size, |
| 522 | + effective_size, |
| 523 | + sort_options={"added_date": -1}, |
521 | 524 | db_table=db_table, |
522 | | - source_table_name=LATEST_VIDEOS_TABLE_NAME, |
| 525 | + source_table_name=VIDEOS_TABLE_NAME, |
523 | 526 | ) |
524 | 527 |
|
525 | 528 |
|
@@ -982,9 +985,7 @@ async def fetch_video_title(youtube_url: str) -> str: # noqa: D401 |
982 | 985 | # --------------------------------------------------------------------------- |
983 | 986 |
|
984 | 987 |
|
985 | | -async def process_video_submission( |
986 | | - video_id: VideoID, youtube_video_id: str |
987 | | -) -> None: # noqa: D401,E501 |
| 988 | +async def process_video_submission(video_id: VideoID, youtube_video_id: str) -> None: # noqa: D401,E501 |
988 | 989 | """Background processing stub that updates status transitions. |
989 | 990 |
|
990 | 991 | In production most metadata is now fetched inline, but this helper can |
|
0 commit comments