From 22fd61a33c3e36efb6bd0265ef8026af2661adfa Mon Sep 17 00:00:00 2001 From: nstarikov Date: Tue, 11 Aug 2026 11:56:47 +0300 Subject: [PATCH] fix: place manual video imports at queue top --- dzen-assistant/admin/src/App.tsx | 3 ++- dzen-assistant/app/routes.py | 4 +++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/dzen-assistant/admin/src/App.tsx b/dzen-assistant/admin/src/App.tsx index c45a23c..e97d5ea 100644 --- a/dzen-assistant/admin/src/App.tsx +++ b/dzen-assistant/admin/src/App.tsx @@ -45,6 +45,7 @@ type Video = { id: number title: string sourceUrl: string + manual?: boolean status: string progressPercent: number progressStage: string @@ -1523,7 +1524,7 @@ export default function App() {

{video.title || `Ролик #${video.id}`}

- Опубликовано: {formatVideoDate(video.publishedAt)} + {video.manual ? "Добавлено" : "Опубликовано"}: {formatVideoDate(video.publishedAt)} Длительность: {formatDuration(video.durationSeconds)}
{hasStarted && video.progressStage ?

{video.progressStage}

: null} diff --git a/dzen-assistant/app/routes.py b/dzen-assistant/app/routes.py index 0d01cf9..0904b78 100644 --- a/dzen-assistant/app/routes.py +++ b/dzen-assistant/app/routes.py @@ -463,7 +463,8 @@ def import_video(payload: ManualVideoIn, session: Session = Depends(get_session) if existing: raise HTTPException(status_code=409, detail=f"Этот ролик уже добавлен: #{existing.id}") - published_at = parse_upload_date(metadata.get("upload_date")) + # A manually imported video enters our queue now, regardless of its original age. + published_at = datetime.now(timezone.utc) duration = metadata.get("duration") try: duration = round(float(duration)) if duration is not None else None @@ -505,6 +506,7 @@ def list_videos(session: Session = Depends(get_session)) -> list[dict]: "id": video.id, "title": video.title, "sourceUrl": video.source_url, + "manual": video.source_id is None, "status": video.status, "progressPercent": video.progress_percent, "progressStage": video.progress_stage,