testing yuk
This commit is contained in:
@@ -23,7 +23,7 @@ export async function OPTIONS() {
|
||||
|
||||
export async function GET() {
|
||||
try {
|
||||
// Get all mahasiswa data
|
||||
// Ambil semua data mahasiswa
|
||||
const { data, error } = await supabase
|
||||
.from('mahasiswa')
|
||||
.select('tahun_angkatan, jk');
|
||||
@@ -43,7 +43,7 @@ export async function GET() {
|
||||
);
|
||||
}
|
||||
|
||||
// Group by tahun_angkatan and calculate statistics
|
||||
// Kelompokkan berdasarkan tahun_angkatan dan hitung statistik
|
||||
const groupedData = data.reduce((acc, item) => {
|
||||
const tahun = item.tahun_angkatan;
|
||||
if (!acc[tahun]) {
|
||||
@@ -65,7 +65,7 @@ export async function GET() {
|
||||
return acc;
|
||||
}, {} as Record<number, MahasiswaStatistik>);
|
||||
|
||||
// Convert to array and sort by tahun_angkatan
|
||||
// Konversi ke array dan urutkan berdasarkan tahun_angkatan
|
||||
const results: MahasiswaStatistik[] = Object.values(groupedData)
|
||||
.sort((a, b) => a.tahun_angkatan - b.tahun_angkatan);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user