feat(admin-dashboard): plan share meta includes other pct
This commit is contained in:
@@ -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
|
||||
<div class="adm-mini-meta" data-role="plan-order-share-top5-meta">
|
||||
<span class="adm-mini-meta-item">全量订单:<strong>{{ (int) $totalOrders }}</strong></span>
|
||||
@@ -446,6 +447,8 @@
|
||||
<span class="adm-mini-meta-sep">|</span>
|
||||
<span class="adm-mini-meta-item">覆盖率:<strong>{{ $shareCoveragePct }}%</strong></span>
|
||||
<span class="adm-mini-meta-sep">|</span>
|
||||
<span class="adm-mini-meta-item">其它:<strong>{{ $shareOtherPct }}%</strong></span>
|
||||
<span class="adm-mini-meta-sep">|</span>
|
||||
<span class="adm-mini-meta-item">Top1占比:<strong>{{ $shareTop1Pct }}%</strong></span>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Feature;
|
||||
|
||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||
use Tests\TestCase;
|
||||
|
||||
class AdminDashboardPlanOrderShareTop5MetaShouldIncludeOtherPctTest extends TestCase
|
||||
{
|
||||
use RefreshDatabase;
|
||||
|
||||
protected function loginAsPlatformAdmin(): void
|
||||
{
|
||||
$this->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);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user