testing yuk
This commit is contained in:
@@ -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_prestasi: group.total_mahasiswa_prestasi,
|
||||
rata_rata_ipk: Math.round((group.total_ipk / group.total_mahasiswa_prestasi) * 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);
|
||||
|
||||
Reference in New Issue
Block a user