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

@@ -25,7 +25,7 @@ export async function GET(request: Request) {
);
}
// Group and calculate statistics in JavaScript
// Kelompokkan dan hitung statistik di JavaScript
const groupedData = data.reduce((acc: any[], row: any) => {
const tahunAngkatan = row.tahun_angkatan;
const ipk = row.ipk;
@@ -50,14 +50,14 @@ export async function GET(request: Request) {
return acc;
}, []);
// Calculate average IPK and format the results
// Hitung rata-rata IPK dan format hasil
const result = groupedData.map((group: any) => ({
tahun_angkatan: group.tahun_angkatan,
total_mahasiswa_beasiswa: group.total_mahasiswa_beasiswa,
rata_rata_ipk: Math.round((group.total_ipk / group.total_mahasiswa_beasiswa) * 100) / 100
}));
// Sort by tahun_angkatan ascending
// Urutkan berdasarkan tahun_angkatan ascending
const sortedData = result.sort((a: any, b: any) => a.tahun_angkatan - b.tahun_angkatan);
return NextResponse.json(sortedData);