diff --git a/app/services/task_service.py b/app/services/task_service.py index dcc51b1..b7d42c0 100644 --- a/app/services/task_service.py +++ b/app/services/task_service.py @@ -156,7 +156,7 @@ def get_task(session: Session, task_id: str) -> Task | None: def hydrate_task_progress(session: Session, task: Task) -> Task: display_number = calculate_task_display_number(session, task) task.display_number = display_number - task.display_id = f"#{display_number}" + task.display_id = str(display_number) task.created_at_label = format_datetime_minute(task.created_at) task.scale_label = ( f"{PLATFORM_LABELS.get(task.platform, task.platform)} · " diff --git a/app/templates/items/detail.html b/app/templates/items/detail.html index 6daa8a1..1ab1d53 100644 --- a/app/templates/items/detail.html +++ b/app/templates/items/detail.html @@ -4,7 +4,7 @@ {% endblock %} diff --git a/app/templates/partials/task_rows.html b/app/templates/partials/task_rows.html index 4c28b71..a3eb53a 100644 --- a/app/templates/partials/task_rows.html +++ b/app/templates/partials/task_rows.html @@ -4,7 +4,7 @@ {% set ai_percent = rate_percent(task.analysis_success_rate) %} - {{ task.display_id or ("#" ~ loop.index) }} + {{ task.display_id or loop.index }} {% if task.is_demo %}
Demo 数据 {% endif %} diff --git a/app/templates/tasks/detail.html b/app/templates/tasks/detail.html index f6ca8ce..4a42675 100644 --- a/app/templates/tasks/detail.html +++ b/app/templates/tasks/detail.html @@ -83,7 +83,7 @@

diff --git a/tests/integration/test_routes.py b/tests/integration/test_routes.py index 8b12a8f..f9a57f3 100644 --- a/tests/integration/test_routes.py +++ b/tests/integration/test_routes.py @@ -99,8 +99,9 @@ def test_index_page_uses_short_task_numbers_compact_fields_and_friendly_error_co assert response.status_code == 200 visible_text = BeautifulSoup(response.text, "html.parser").get_text(" ") - assert "#1" in visible_text - assert "#2" in visible_text + assert " 1 " in f" {visible_text} " + assert " 2 " in f" {visible_text} " + assert "#" not in visible_text assert first_id not in visible_text assert second_id not in visible_text assert "2026-07-03 10:30" in visible_text @@ -194,11 +195,12 @@ def test_task_detail_uses_short_number_title_and_keeps_full_uuid_for_diagnostics assert response.status_code == 200 visible_text = BeautifulSoup(response.text, "html.parser").get_text(" ") - assert "任务 #1 - 热榜评论分析工具" in response.text - assert "任务 #1" in visible_text + assert "任务 1 - 热榜评论分析工具" in response.text + assert "任务 1" in visible_text assert "完整 ID" in visible_text assert task_id in visible_text assert "任务 #33333333-3333-4333-8333-333333333333" not in visible_text + assert "#" not in visible_text assert "创建时间 2026-07-03 10:30" in visible_text @@ -416,6 +418,7 @@ def test_result_pages_render_seeded_data(): assert task_response.status_code == 200 assert "热点标题" in task_response.text + assert "热点 1:热点标题" in BeautifulSoup(task_response.text, "html.parser").get_text(" ") assert 'onclick="window.location.reload()"' in task_response.text assert hotspot_response.status_code == 200 assert "热点总结" in hotspot_response.text @@ -431,6 +434,9 @@ def test_result_pages_render_seeded_data(): assert "