Explorar o código

fix: simplify present_count calculation in attendance method

ebagabee hai 1 semana
pai
achega
b9e2154ffd
Modificáronse 1 ficheiros con 1 adicións e 1 borrados
  1. 1 1
      app/Services/FranchisorDashboardService.php

+ 1 - 1
app/Services/FranchisorDashboardService.php

@@ -197,7 +197,7 @@ private function attendance(array $unitIds, Carbon $startDate, Carbon $endDate):
                 'u.id',
                 'u.fantasy_name',
                 DB::raw('COUNT(ca.id) as attendance_count'),
-                DB::raw('SUM(CASE WHEN ca.in_class = 1 THEN 1 ELSE 0 END) as present_count'),
+                DB::raw('SUM(CASE WHEN ca.in_class THEN 1 ELSE 0 END) as present_count'),
             ]);
 
         $total = (int) $rows->sum('attendance_count');