From 99a43d573c9c144343d75425bdfd30e25becdc07 Mon Sep 17 00:00:00 2001 From: Diandaru Date: Thu, 19 Dec 2024 04:44:54 +0000 Subject: [PATCH 1/2] Fixes coding style --- app/Http/Controllers/SiswaController.php | 59 ++++++++++----------- app/Http/Controllers/SiswaRplController.php | 6 +-- 2 files changed, 32 insertions(+), 33 deletions(-) diff --git a/app/Http/Controllers/SiswaController.php b/app/Http/Controllers/SiswaController.php index 63920b7..91ab581 100644 --- a/app/Http/Controllers/SiswaController.php +++ b/app/Http/Controllers/SiswaController.php @@ -12,44 +12,43 @@ class SiswaController extends Controller { public function index(Request $request) -{ - $statusFilter = $request->get('status', 'all'); - $kategoriFilter = $request->get('kategori', 'all'); // Default 'all' - $userId = Auth::id(); + { + $statusFilter = $request->get('status', 'all'); + $kategoriFilter = $request->get('kategori', 'all'); // Default 'all' + $userId = Auth::id(); - // Query dasar untuk data siswa - $siswaQuery = Siswa::where('user_id', $userId); + // Query dasar untuk data siswa + $siswaQuery = Siswa::where('user_id', $userId); - // Filter status jika tidak "all" - if ($statusFilter !== 'all') { - $siswaQuery->where('status', $statusFilter); - } - - // Filter kategori jika tidak "all" - if ($kategoriFilter !== 'all') { - $siswaQuery->where('kategori', $kategoriFilter); - } + // Filter status jika tidak "all" + if ($statusFilter !== 'all') { + $siswaQuery->where('status', $statusFilter); + } - // Proses data siswa dan hitung total waktu - $siswa = $siswaQuery->orderBy('created_at', 'desc')->get()->map(function ($item) { - if ($item->waktu_mulai && $item->waktu_selesai) { - $waktuMulai = Carbon::parse($item->waktu_mulai); - $waktuSelesai = Carbon::parse($item->waktu_selesai); - $item->total_waktu = $waktuSelesai->diff($waktuMulai)->format('%H:%I:%S'); - } else { - $item->total_waktu = '-'; + // Filter kategori jika tidak "all" + if ($kategoriFilter !== 'all') { + $siswaQuery->where('kategori', $kategoriFilter); } - \Log::info("Item ID: {$item->id}, Waktu Mulai: {$item->waktu_mulai}"); - return $item; - }); + // Proses data siswa dan hitung total waktu + $siswa = $siswaQuery->orderBy('created_at', 'desc')->get()->map(function ($item) { + if ($item->waktu_mulai && $item->waktu_selesai) { + $waktuMulai = Carbon::parse($item->waktu_mulai); + $waktuSelesai = Carbon::parse($item->waktu_selesai); + $item->total_waktu = $waktuSelesai->diff($waktuMulai)->format('%H:%I:%S'); + } else { + $item->total_waktu = '-'; + } + \Log::info("Item ID: {$item->id}, Waktu Mulai: {$item->waktu_mulai}"); - $aktivitas = Aktivitas::all(); - $materitkj = Materi::where('jurusan', 'TKJ')->get(); + return $item; + }); - return view('monitoring_siswa.siswa', compact('siswa', 'materitkj', 'aktivitas', 'statusFilter', 'kategoriFilter')); -} + $aktivitas = Aktivitas::all(); + $materitkj = Materi::where('jurusan', 'TKJ')->get(); + return view('monitoring_siswa.siswa', compact('siswa', 'materitkj', 'aktivitas', 'statusFilter', 'kategoriFilter')); + } public function updateTime(Request $request, $id) { diff --git a/app/Http/Controllers/SiswaRplController.php b/app/Http/Controllers/SiswaRplController.php index 586a6ed..8ba84e8 100644 --- a/app/Http/Controllers/SiswaRplController.php +++ b/app/Http/Controllers/SiswaRplController.php @@ -23,8 +23,8 @@ public function index(Request $request) $siswaQuery->where('status', $statusFilterrpl); } - // Filter kategori jika tidak "all" - if ($kategoriFilter !== 'all') { + // Filter kategori jika tidak "all" + if ($kategoriFilter !== 'all') { $siswaQuery->where('kategori', $kategoriFilter); } @@ -44,7 +44,7 @@ public function index(Request $request) $aktivitasrpl = Aktivitas::all(); $materirpl = Materi::where('jurusan', 'RPL')->get(); - return view('monitoring_siswa.siswarpl', compact('siswarpl', 'materirpl', 'aktivitasrpl', 'statusFilterrpl','kategoriFilter')); + return view('monitoring_siswa.siswarpl', compact('siswarpl', 'materirpl', 'aktivitasrpl', 'statusFilterrpl', 'kategoriFilter')); } public function updateTime(Request $request, $id) From a7024d133e481268be503c952ae56a292e538e7e Mon Sep 17 00:00:00 2001 From: Diandaru Date: Thu, 19 Dec 2024 11:53:58 +0700 Subject: [PATCH 2/2] ehehhe --- resources/views/monitoring_siswa/siswa.blade.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/views/monitoring_siswa/siswa.blade.php b/resources/views/monitoring_siswa/siswa.blade.php index 260f5b6..1affc10 100644 --- a/resources/views/monitoring_siswa/siswa.blade.php +++ b/resources/views/monitoring_siswa/siswa.blade.php @@ -89,7 +89,7 @@ class="form-control" value="{{ request('waktu_selesai') }}" -
+