fix: [equipment] 점검표 판정 로직 - 오늘까지 도래한 날짜만 검사

- 미래 날짜는 판정에서 제외
- 일일: 오늘까지의 평일만 검사
- 기타 주기: check_date가 오늘 이전인 열만 검사
This commit is contained in:
김보곤
2026-02-28 14:42:00 +09:00
parent 1a3ec05d6d
commit f5090b48b0

View File

@@ -40,7 +40,8 @@
@endphp
@php
// 자동 판정 계산: 주말(daily) 제외, 모든 셀이 good/repaired면 합격
// 자동 판정: 주말(daily) 제외, 오늘까지 도래한 날짜만 검사
$today = now()->format('Y-m-d');
$totalChecks = 0;
$passedChecks = 0;
foreach ($templates as $tmpl) {
@@ -48,8 +49,11 @@
if ($isDaily && \App\Enums\InspectionCycle::isWeekend($period, $ci)) {
continue;
}
$totalChecks++;
$cd = \App\Enums\InspectionCycle::resolveCheckDate($cycle, $period, $ci);
if ($cd > $today) {
continue;
}
$totalChecks++;
$k = $tmpl->id . '_' . $cd;
$d = isset($details[$k]) ? $details[$k]->first() : null;
if ($d && in_array($d->result, ['good', 'repaired'])) {