fix: laporan rekap pakai snapshot student_class (kelas saat pelanggaran) — akurat walau siswa naik kelas/lulus
This commit is contained in:
@@ -63,9 +63,9 @@ class ViolationReportController extends Controller
|
|||||||
->sortByDesc('jumlah')
|
->sortByDesc('jumlah')
|
||||||
->values();
|
->values();
|
||||||
|
|
||||||
$perKelas = $violations->groupBy(fn ($v) => $v->student?->class?->name ?? 'Tanpa Kelas')
|
$perKelas = $violations->groupBy(fn ($v) => $v->student_class ?: ($v->student?->class?->name ?? 'Tanpa Kelas'))
|
||||||
->map(fn ($group) => [
|
->map(fn ($group) => [
|
||||||
'kelas' => $group->first()->student?->class?->name ?? 'Tanpa Kelas',
|
'kelas' => $group->first()->student_class ?: ($group->first()->student?->class?->name ?? 'Tanpa Kelas'),
|
||||||
'jumlah' => $group->count(),
|
'jumlah' => $group->count(),
|
||||||
'poin' => $group->sum('points'),
|
'poin' => $group->sum('points'),
|
||||||
])
|
])
|
||||||
@@ -161,9 +161,9 @@ class ViolationReportController extends Controller
|
|||||||
->sortByDesc('jumlah')
|
->sortByDesc('jumlah')
|
||||||
->values();
|
->values();
|
||||||
|
|
||||||
$perKelas = $rows->groupBy(fn ($v) => $v->student?->class?->name ?? 'Tanpa Kelas')
|
$perKelas = $rows->groupBy(fn ($v) => $v->student_class ?: ($v->student?->class?->name ?? 'Tanpa Kelas'))
|
||||||
->map(fn ($group) => [
|
->map(fn ($group) => [
|
||||||
'kelas' => $group->first()->student?->class?->name ?? 'Tanpa Kelas',
|
'kelas' => $group->first()->student_class ?: ($group->first()->student?->class?->name ?? 'Tanpa Kelas'),
|
||||||
'jumlah' => $group->count(),
|
'jumlah' => $group->count(),
|
||||||
'poin' => $group->sum('points'),
|
'poin' => $group->sum('points'),
|
||||||
])
|
])
|
||||||
|
|||||||
@@ -159,7 +159,7 @@
|
|||||||
<td>{{ $v->violation_date?->format('d/m/Y') }}</td>
|
<td>{{ $v->violation_date?->format('d/m/Y') }}</td>
|
||||||
<td>{{ $v->student?->nisn }}</td>
|
<td>{{ $v->student?->nisn }}</td>
|
||||||
<td>{{ $v->student?->full_name }}</td>
|
<td>{{ $v->student?->full_name }}</td>
|
||||||
<td>{{ $v->student?->class?->name }}</td>
|
<td>{{ $v->student_class ?: $v->student?->class?->name }}</td>
|
||||||
<td>
|
<td>
|
||||||
<div>{{ $v->violationType?->name }} <span style="color:#666">({{ $v->violationType?->category?->name ?? '-' }})</span></div>
|
<div>{{ $v->violationType?->name }} <span style="color:#666">({{ $v->violationType?->category?->name ?? '-' }})</span></div>
|
||||||
@if ($v->description)
|
@if ($v->description)
|
||||||
|
|||||||
Reference in New Issue
Block a user