feat: refine web analytics and history views
This commit is contained in:
@@ -92,6 +92,15 @@ class FakeRepository:
|
||||
}
|
||||
], 1
|
||||
|
||||
def list_history_month_counts(self) -> List[Dict[str, Any]]:
|
||||
return [
|
||||
{
|
||||
"month_key": "2026-07",
|
||||
"daily_count": 3,
|
||||
"monthly_count": 2,
|
||||
}
|
||||
]
|
||||
|
||||
def list_months(self) -> List[Dict[str, Any]]:
|
||||
return self.months
|
||||
|
||||
@@ -105,6 +114,7 @@ class FakeRepository:
|
||||
"version": "1.2",
|
||||
"month_key": month_key,
|
||||
"updated_at": "2026-07-28T12:00:00+08:00",
|
||||
"min_arrival_date": "2026-07-01",
|
||||
"max_arrival_date": "2026-07-26",
|
||||
"source_monthly_sha256": "a" * 64,
|
||||
"overall": {
|
||||
@@ -440,8 +450,9 @@ class PortalApplicationTests(unittest.TestCase):
|
||||
self.assertNotIn('class="company-scope"', desktop_text)
|
||||
self.assertNotIn("固定生成公司", desktop_text)
|
||||
self.assertIn('title="重新读取服务状态、Excel 来源和生成记录"', desktop_text)
|
||||
self.assertIn('title="选择 C/O 所属报表月份,并筛选下方生成记录"', desktop_text)
|
||||
self.assertIn('aria-label="报表月份"', desktop_text)
|
||||
self.assertIn('title="选择 C/O 所属的生成月份"', desktop_text)
|
||||
self.assertIn('aria-label="生成月份"', desktop_text)
|
||||
self.assertIn('id="company-history-month"', desktop_text)
|
||||
self.assertNotIn("生成截至", desktop_text)
|
||||
self.assertEqual(desktop_text.count('<span>生成</span>'), 3)
|
||||
self.assertIn("生成时间", desktop_text)
|
||||
@@ -472,7 +483,6 @@ class PortalApplicationTests(unittest.TestCase):
|
||||
for removed in (
|
||||
"codex",
|
||||
"本地报表处理",
|
||||
"业务月份",
|
||||
"渠道工作表",
|
||||
"所有渠道工作表",
|
||||
"room mix",
|
||||
@@ -501,6 +511,9 @@ class PortalApplicationTests(unittest.TestCase):
|
||||
self.auth_headers,
|
||||
)
|
||||
)
|
||||
history_months = decoded(
|
||||
self.app.handle("GET", "/api/history-months", self.auth_headers)
|
||||
)
|
||||
analytics = decoded(
|
||||
self.app.handle(
|
||||
"GET",
|
||||
@@ -519,6 +532,17 @@ class PortalApplicationTests(unittest.TestCase):
|
||||
)
|
||||
)
|
||||
self.assertEqual(jobs["data"][0]["job_id"], "job-1")
|
||||
self.assertEqual(
|
||||
history_months["data"],
|
||||
[
|
||||
{
|
||||
"month_key": "2026-07",
|
||||
"daily_count": 3,
|
||||
"monthly_count": 2,
|
||||
"company_count": 0,
|
||||
}
|
||||
],
|
||||
)
|
||||
self.assertEqual(
|
||||
jobs["pagination"],
|
||||
{
|
||||
@@ -535,6 +559,7 @@ class PortalApplicationTests(unittest.TestCase):
|
||||
self.assertEqual(monthly["data"][0]["max_arrival_date"], "2026-07-26")
|
||||
self.assertEqual(monthly["pagination"]["total"], 1)
|
||||
self.assertEqual(monthly["pagination"]["limit"], 50)
|
||||
self.assertEqual(analytics["data"]["min_arrival_date"], "2026-07-01")
|
||||
self.assertEqual(analytics["data"]["channels"][0]["worksheet"], "COMPANY-A")
|
||||
self.assertEqual(
|
||||
h5_months,
|
||||
|
||||
Reference in New Issue
Block a user