Minor fix
This commit is contained in:
@@ -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]) {
|
||||||
|
|||||||
Reference in New Issue
Block a user