fix class progress admin side

This commit is contained in:
root
2026-04-25 21:56:33 -04:00
parent 5c544f93b9
commit 5e8fa682b9
9 changed files with 475 additions and 172 deletions
@@ -17,16 +17,19 @@ class ClassProgressGroupCollection extends ResourceCollection
{
$groups = [];
foreach ($paginator->items() as $report) {
$key = $report->week_start?->format('Y-m-d') ?? '';
if ($key === '') {
$weekStart = $report->week_start?->format('Y-m-d') ?? '';
$sectionId = (int) ($report->class_section_id ?? 0);
if ($weekStart === '' || $sectionId <= 0) {
continue;
}
$key = $sectionId . '|' . $weekStart;
if (!isset($groups[$key])) {
$groups[$key] = [
'week_start' => $key,
'week_start' => $weekStart,
'week_end' => $report->week_end?->format('Y-m-d'),
'class_section_id' => $report->class_section_id,
'class_section_id' => $sectionId,
'class_section_name' => $report->classSection?->class_section_name ?? '',
'reports' => [],
];