Kaynağa Gözat

fix: update attendance query to use unit name instead of fantasy name

alvesantos 2 hafta önce
ebeveyn
işleme
3aea74f2fe
1 değiştirilmiş dosya ile 4 ekleme ve 4 silme
  1. 4 4
      app/Services/FranchisorDashboardService.php

+ 4 - 4
app/Services/FranchisorDashboardService.php

@@ -230,11 +230,11 @@ private function attendance(array $unitIds, Carbon $startDate, Carbon $endDate):
             })
             ->whereNull('u.deleted_at')
             ->when(!empty($unitIds), fn ($q) => $q->whereIn('u.id', $unitIds))
-            ->groupBy('u.id', 'u.fantasy_name')
-            ->orderBy('u.fantasy_name')
+            ->groupBy('u.id', 'u.name')
+            ->orderBy('u.name')
             ->get([
                 'u.id',
-                'u.fantasy_name',
+                'u.name',
                 DB::raw('COUNT(ca.id) as attendance_count'),
                 DB::raw('SUM(CASE WHEN ca.in_class THEN 1 ELSE 0 END) as present_count'),
             ]);
@@ -252,7 +252,7 @@ private function attendance(array $unitIds, Carbon $startDate, Carbon $endDate):
 
                 return [
                     'id'        => (int) $row->id,
-                    'unit'      => $row->fantasy_name,
+                    'unit'      => $row->name,
                     'frequency' => $average,
                     'status'    => $count === 0
                         ? 'Sem dados'