From 3278fae48b9825d7af4c4ac10f409bae3f9bcc42 Mon Sep 17 00:00:00 2001 From: renshen <1005457301@qq.com> Date: Thu, 5 Nov 2026 14:07:24 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E9=9A=90=E8=97=8F=E7=A9=BA=E7=9A=84?= =?UTF-8?q?=E6=97=A5=E5=BF=97=E6=89=A3=E5=88=86=E7=BB=9F=E8=AE=A1=E5=8C=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../pages/other/log-statistics.blade.php | 100 ++++++++++-------- tests/Feature/Business/PagesTest.php | 45 ++++++++ 2 files changed, 99 insertions(+), 46 deletions(-) diff --git a/resources/views/business/pages/other/log-statistics.blade.php b/resources/views/business/pages/other/log-statistics.blade.php index 16bc7236..0938a727 100644 --- a/resources/views/business/pages/other/log-statistics.blade.php +++ b/resources/views/business/pages/other/log-statistics.blade.php @@ -375,13 +375,21 @@ 'date' => $worklogCurrent['statistics_date'], 'details' => 1, ]) . '#worklog-detail'; + $hasWorklogPenalty = $worklogPenaltyError !== null || $worklogPenalty['members'] !== []; @endphp
- - {{ $worklogPenalty['start_date'] ?: '2026-11-04' }} 起扣分合计 - {{ $worklogPenalty['total_points_formatted'] }} - 点击查看扣分明细 - + @if ($hasWorklogPenalty) + + {{ $worklogPenalty['start_date'] ?: '2026-11-04' }} 起扣分合计 + {{ $worklogPenalty['total_points_formatted'] }} + 点击查看扣分明细 + + @else +
+ {{ $worklogPenalty['start_date'] ?: '2026-11-04' }} 起扣分合计 + {{ $worklogPenalty['total_points_formatted'] }} +
+ @endif {{ $worklogCurrent['statistics_date'] }} 提交人数 {{ number_format((int) $worklogCurrent['submitter_count']) }} @@ -504,46 +512,46 @@ @endif -
-
- 日志漏写扣分统计 - - @if ($worklogPenalty['start_date']) - {{ $worklogPenalty['start_date'] }} 至 {{ $worklogPenalty['end_date'] }} · 合计 {{ $worklogPenalty['total_points_formatted'] }} 分 - @else - 暂无已截止统计日 - @endif - -
- @if ($worklogPenaltyError) -
{{ $worklogPenaltyError }}
- @elseif ($worklogPenalty['members'] === []) -
当前时间范围暂无漏写扣分记录。
- @else -
- - - - - - - - - - - - @foreach ($worklogPenalty['members'] as $penalty) - - - - - - - - @endforeach - -
姓名漏写次数漏写日期扣分计算累计扣分
{{ $penalty['name'] }}{{ number_format((int) $penalty['missed_count']) }}{{ implode('、', $penalty['missed_dates']) }}{{ $penalty['penalty_formula'] }}{{ $penalty['penalty_points_formatted'] }}
+ @if ($hasWorklogPenalty) +
+
+ 日志漏写扣分统计 + + @if ($worklogPenalty['start_date']) + {{ $worklogPenalty['start_date'] }} 至 {{ $worklogPenalty['end_date'] }} · 合计 {{ $worklogPenalty['total_points_formatted'] }} 分 + @else + 暂无已截止统计日 + @endif +
- @endif -
+ @if ($worklogPenaltyError) +
{{ $worklogPenaltyError }}
+ @else +
+ + + + + + + + + + + + @foreach ($worklogPenalty['members'] as $penalty) + + + + + + + + @endforeach + +
姓名漏写次数漏写日期扣分计算累计扣分
{{ $penalty['name'] }}{{ number_format((int) $penalty['missed_count']) }}{{ implode('、', $penalty['missed_dates']) }}{{ $penalty['penalty_formula'] }}{{ $penalty['penalty_points_formatted'] }}
+
+ @endif +
+ @endif
diff --git a/tests/Feature/Business/PagesTest.php b/tests/Feature/Business/PagesTest.php index d87a4367..9138f464 100644 --- a/tests/Feature/Business/PagesTest.php +++ b/tests/Feature/Business/PagesTest.php @@ -188,6 +188,51 @@ class PagesTest extends FeatureTestCase } } + public function testLogStatisticsPageHidesTheEmptyPenaltyPanel(): void + { + Carbon::setTestNow(Carbon::parse('2026-11-05 15:00:00', 'Asia/Shanghai')); + + $repository = Mockery::mock(DingWorklogMirrorRepository::class); + $repository->shouldReceive('available')->andReturnTrue(); + $repository->shouldReceive('state')->once()->andReturn([ + 'status' => 'succeeded', + 'last_error_code' => null, + 'last_attempted_at' => '2026-11-05 14:00:00', + 'last_succeeded_at' => '2026-11-05 14:00:00', + 'mirror_row_count' => 1, + ]); + $repository->shouldReceive('dailySummary')->once()->andReturn([]); + $repository->shouldNotReceive('submissionsForDate'); + $repository->shouldNotReceive('permissionApplyUrl'); + $this->app->instance(DingWorklogMirrorRepository::class, $repository); + + $penalty = Mockery::mock(DingWorklogPenaltyCalculator::class); + $penalty->shouldReceive('summary')->once()->andReturn([ + 'start_date' => '2026-11-04', + 'end_date' => '2026-11-04', + 'total_points' => '0', + 'total_points_formatted' => '0', + 'members' => [], + ]); + $this->app->instance(DingWorklogPenaltyCalculator::class, $penalty); + + try { + $this->loginAs() + ->get(route('business.pages.show', [ + 'section' => 'other', + 'page' => 'log-statistics', + ])) + ->assertOk() + ->assertSeeText('2026-11-04 起扣分合计') + ->assertDontSeeText('点击查看扣分明细') + ->assertDontSeeText('日志漏写扣分统计') + ->assertDontSeeText('当前时间范围暂无漏写扣分记录。') + ->assertDontSee('id="worklog-penalty"', false); + } finally { + Carbon::setTestNow(); + } + } + public function testInventoryReportProvidesAFilteredExportButton(): void { InventoryWarehouseNameMapping::query()->create([ -- 2.47.2