Minor fix

This commit is contained in:
Clayzxr
2025-01-21 16:32:00 +01:00
parent db6669901b
commit 661b59645b
2 changed files with 0 additions and 3 deletions
@@ -21,7 +21,6 @@ export default function ConsultStudents() {
useEffect(() => { useEffect(() => {
const fetchPromotionsAndStudents = async () => { const fetchPromotionsAndStudents = async () => {
try { try {
// Récupérer toutes les promotions
const promoResponse = await fetch("/mobility/api/promotions"); const promoResponse = await fetch("/mobility/api/promotions");
if (!promoResponse.ok) { if (!promoResponse.ok) {
throw new Error(`Error fetching promotions: ${promoResponse.statusText}`); throw new Error(`Error fetching promotions: ${promoResponse.statusText}`);
@@ -29,14 +28,12 @@ export default function ConsultStudents() {
const promos: Promotion[] = await promoResponse.json(); const promos: Promotion[] = await promoResponse.json();
setPromotions(promos); setPromotions(promos);
// Récupérer les étudiants
const studentsResponse = await fetch("/mobility/api/insert_students"); const studentsResponse = await fetch("/mobility/api/insert_students");
if (!studentsResponse.ok) { if (!studentsResponse.ok) {
throw new Error(`Error fetching students: ${studentsResponse.statusText}`); throw new Error(`Error fetching students: ${studentsResponse.statusText}`);
} }
const students: Student[] = await studentsResponse.json(); const students: Student[] = await studentsResponse.json();
// Grouper les étudiants par promotionId
const grouped: Record<number, Student[]> = {}; const grouped: Record<number, Student[]> = {};
for (const student of students) { for (const student of students) {
if (!grouped[student.promotionId]) { if (!grouped[student.promotionId]) {