From f66cbd51f16338b4259b6b1887ac0656a7439eed Mon Sep 17 00:00:00 2001 From: Diandaru Date: Fri, 27 Dec 2024 06:23:34 +0000 Subject: [PATCH] Fixes coding style --- app/Http/Controllers/DashboardRplController.php | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/app/Http/Controllers/DashboardRplController.php b/app/Http/Controllers/DashboardRplController.php index 396014c..91e708c 100644 --- a/app/Http/Controllers/DashboardRplController.php +++ b/app/Http/Controllers/DashboardRplController.php @@ -101,7 +101,6 @@ public function index(Request $request) ], ]; - $siswaDataLearning = Siswa::where('user_id', $userId) ->where('kategori', 'Learning') ->get() @@ -111,12 +110,15 @@ public function index(Request $request) if ($item->waktu_mulai && $item->waktu_selesai) { $waktuMulai = Carbon::parse($item->waktu_mulai); $waktuSelesai = Carbon::parse($item->waktu_selesai); + return $waktuSelesai->greaterThan($waktuMulai) ? $waktuSelesai->diffInSeconds($waktuMulai) : 0; } + return 0; }); $percentage = $totalWaktuLearning ? ($totalTime / $totalWaktuLearning) * 100 : 0; + return ['totalTime' => $totalTime, 'percentage' => $percentage]; }); @@ -126,11 +128,10 @@ public function index(Request $request) [ 'data' => $siswaDataLearning->pluck('percentage')->values(), 'backgroundColor' => ['#FF6384', '#36A2EB', '#FFCE56', '#4BC0C0', '#9966FF'], - ] - ] + ], + ], ]; - $activityData = $jumlahAktivitasLearning; return view('dashboardrpl', compact(