Ver código fonte

fix: simplify present_count calculation in attendance method

ebagabee 1 semana atrás
pai
commit
b9e2154ffd
1 arquivos alterados com 1 adições e 1 exclusões
  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');