From c1afc14b750309a56f7874f95fec102350d7eb33 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=90=9D=E5=8D=9C?= Date: Mon, 16 Mar 2026 14:47:33 +0800 Subject: [PATCH] feat(admin-dashboard): plan share meta includes other pct --- resources/views/admin/dashboard.blade.php | 3 ++ ...ShareTop5MetaShouldIncludeOtherPctTest.php | 34 +++++++++++++++++++ 2 files changed, 37 insertions(+) create mode 100644 tests/Feature/AdminDashboardPlanOrderShareTop5MetaShouldIncludeOtherPctTest.php diff --git a/resources/views/admin/dashboard.blade.php b/resources/views/admin/dashboard.blade.php index a9c47ae..148ec53 100644 --- a/resources/views/admin/dashboard.blade.php +++ b/resources/views/admin/dashboard.blade.php @@ -438,6 +438,7 @@ } $shareTop1Pct = $totalOrders > 0 ? round(($shareTop1Count / $totalOrders) * 100, 1) : 0; $shareCoveragePct = $totalOrders > 0 ? round(($top5Orders / $totalOrders) * 100, 1) : 0; + $shareOtherPct = max(0, round(100 - $shareCoveragePct, 1)); @endphp
全量订单:{{ (int) $totalOrders }} @@ -446,6 +447,8 @@ 覆盖率:{{ $shareCoveragePct }}% + 其它:{{ $shareOtherPct }}% + Top1占比:{{ $shareTop1Pct }}%
diff --git a/tests/Feature/AdminDashboardPlanOrderShareTop5MetaShouldIncludeOtherPctTest.php b/tests/Feature/AdminDashboardPlanOrderShareTop5MetaShouldIncludeOtherPctTest.php new file mode 100644 index 0000000..bdf5fc6 --- /dev/null +++ b/tests/Feature/AdminDashboardPlanOrderShareTop5MetaShouldIncludeOtherPctTest.php @@ -0,0 +1,34 @@ +seed(); + + $this->post('/admin/login', [ + 'email' => 'platform.admin@demo.local', + 'password' => 'Platform@123456', + ])->assertRedirect('/admin'); + } + + public function test_dashboard_plan_order_share_top5_meta_should_include_other_pct(): void + { + $this->loginAsPlatformAdmin(); + + $res = $this->get('/admin'); + $res->assertOk(); + + // Top5 占比卡摘要行应包含“其它”占比(100%-覆盖率),避免运营误读 Top5=全部。 + $res->assertSee('data-role="plan-order-share-top5-meta"', false); + $res->assertSee('其它:', false); + $res->assertSee('%', false); + } +}