Commit awal: prototipe UI SIAKAD Untan
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Mahasiswa;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Support\Prototype\MahasiswaData;
|
||||
use App\Support\Prototype\Sample;
|
||||
use Illuminate\Contracts\View\View;
|
||||
|
||||
class PresensiController extends Controller
|
||||
{
|
||||
public function __invoke(): View
|
||||
{
|
||||
$rows = Sample::presensi()->map(fn (array $r): array => $r + [
|
||||
'persen' => MahasiswaData::persenHadir($r),
|
||||
'kurang' => MahasiswaData::persenHadir($r) < MahasiswaData::MIN_HADIR,
|
||||
]);
|
||||
|
||||
$pertemuan = $rows->sum('pertemuan');
|
||||
|
||||
return view('mahasiswa.presensi', [
|
||||
'rows' => $rows,
|
||||
'minimal' => MahasiswaData::MIN_HADIR,
|
||||
'rataRata' => $pertemuan > 0 ? round($rows->sum('hadir') / $pertemuan * 100, 1) : 0.0,
|
||||
'bermasalah' => $rows->where('kurang', true)->values(),
|
||||
]);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user