-
-
-
- | 姓名 |
- 漏写次数 |
- 漏写日期 |
- 扣分计算 |
- 累计扣分 |
-
-
-
- @foreach ($worklogPenalty['members'] as $penalty)
-
- | {{ $penalty['name'] }} |
- {{ number_format((int) $penalty['missed_count']) }} |
- {{ implode('、', $penalty['missed_dates']) }} |
- {{ $penalty['penalty_formula'] }} |
- {{ $penalty['penalty_points_formatted'] }} |
-
- @endforeach
-
-
+ @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)
+
+ | {{ $penalty['name'] }} |
+ {{ number_format((int) $penalty['missed_count']) }} |
+ {{ implode('、', $penalty['missed_dates']) }} |
+ {{ $penalty['penalty_formula'] }} |
+ {{ $penalty['penalty_points_formatted'] }} |
+
+ @endforeach
+
+
+
+ @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([