testing yuk

This commit is contained in:
Randa Firman Putra
2025-09-14 16:59:31 +07:00
parent 248fed0d0b
commit 60211ae829
63 changed files with 315 additions and 315 deletions

View File

@@ -8,7 +8,7 @@ interface KelompokKeahlianLulusTepat {
export async function GET(request: Request) {
try {
// Get all lulus students with their kelompok keahlian
// Ambil semua mahasiswa lulus dengan kelompok keahlian mereka
const { data, error } = await supabase
.from('mahasiswa')
.select(`
@@ -36,7 +36,7 @@ export async function GET(request: Request) {
);
}
// Process data to calculate percentages
// Proses data untuk menghitung persentase
const groupedData = data.reduce((acc, item: any) => {
const nama_kelompok = item.kelompok_keahlian?.nama_kelompok;
if (!nama_kelompok) return acc;
@@ -50,7 +50,7 @@ export async function GET(request: Request) {
acc[nama_kelompok].total_lulus += 1;
// Check if lulus tepat waktu (semester <= 8)
// Cek apakah lulus tepat waktu (semester <= 8)
if (item.semester <= 8) {
acc[nama_kelompok].lulus_tepat += 1;
}
@@ -58,7 +58,7 @@ export async function GET(request: Request) {
return acc;
}, {} as Record<string, { total_lulus: number; lulus_tepat: number }>);
// Convert to final format (without percentage) and sort by count DESC then name ASC
// Konversi ke format akhir (tanpa persentase) dan urutkan berdasarkan jumlah DESC kemudian nama ASC
const results: KelompokKeahlianLulusTepat[] = Object.entries(groupedData)
.map(([nama_kelompok, counts]) => ({
nama_kelompok,