|
|
|
@ -416,32 +416,46 @@ const ReleverNotes = ({ id, anneescolaire, niveau, sessionType = 'ensemble', ref |
|
|
|
} |
|
|
|
|
|
|
|
// MODIFICATION: Fonction totalNotes mise à jour pour utiliser les nouvelles classes |
|
|
|
const totalNotes = () => { |
|
|
|
let totalNotesNormale = document.querySelectorAll('.moyenneUENormale') |
|
|
|
let totalNotesRattrapage = document.querySelectorAll('.moyenneUERattrapage') |
|
|
|
|
|
|
|
let TotalNoteNumber = 0 |
|
|
|
let TotalNoteNumberRepech = 0 |
|
|
|
|
|
|
|
totalNotesNormale.forEach((notes) => { |
|
|
|
TotalNoteNumber += Number(notes.textContent) / totalNotesNormale.length |
|
|
|
// Remplacer la fonction totalNotes() dans ReleverNotes.jsx par celle-ci : |
|
|
|
|
|
|
|
const totalNotes = () => { |
|
|
|
// Calculer la moyenne pondérée par les crédits selon le type de session |
|
|
|
let totalNotesPonderees = 0 |
|
|
|
let totalCredits = 0 |
|
|
|
|
|
|
|
if (sessionType === 'normale') { |
|
|
|
// Utiliser uniquement les notes normales |
|
|
|
matiereWithSemestre.forEach((matiere) => { |
|
|
|
if (matiere.note != null && !isNaN(matiere.note)) { |
|
|
|
totalNotesPonderees += matiere.note * matiere.credit |
|
|
|
totalCredits += matiere.credit |
|
|
|
} |
|
|
|
}) |
|
|
|
|
|
|
|
totalNotesRattrapage.forEach((notes) => { |
|
|
|
TotalNoteNumberRepech += Number(notes.textContent) / totalNotesRattrapage.length |
|
|
|
} else if (sessionType === 'rattrapage') { |
|
|
|
// Utiliser uniquement les notes de rattrapage |
|
|
|
matiereWithSemestre.forEach((matiere) => { |
|
|
|
if (matiere.noterepech != null && !isNaN(matiere.noterepech)) { |
|
|
|
totalNotesPonderees += matiere.noterepech * matiere.credit |
|
|
|
totalCredits += matiere.credit |
|
|
|
} |
|
|
|
}) |
|
|
|
} else { |
|
|
|
// Pour 'ensemble', prendre la meilleure note entre normale et rattrapage pour chaque matière |
|
|
|
matiereWithSemestre.forEach((matiere) => { |
|
|
|
const noteNormale = matiere.note != null && !isNaN(matiere.note) ? matiere.note : 0 |
|
|
|
const noteRattrapage = matiere.noterepech != null && !isNaN(matiere.noterepech) ? matiere.noterepech : 0 |
|
|
|
const bestNote = Math.max(noteNormale, noteRattrapage) |
|
|
|
|
|
|
|
if (bestNote > 0) { |
|
|
|
totalNotesPonderees += bestNote * matiere.credit |
|
|
|
totalCredits += matiere.credit |
|
|
|
} |
|
|
|
}) |
|
|
|
|
|
|
|
// Retourner la note selon le type de session |
|
|
|
if (sessionType === 'normale') { |
|
|
|
return TotalNoteNumber |
|
|
|
} else if (sessionType === 'rattrapage') { |
|
|
|
return TotalNoteNumberRepech |
|
|
|
} else { |
|
|
|
// Pour 'ensemble', prendre la meilleure note |
|
|
|
return Math.max(TotalNoteNumber, TotalNoteNumberRepech) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
return totalCredits > 0 ? totalNotesPonderees / totalCredits : 0 |
|
|
|
} |
|
|
|
|
|
|
|
const [note, setNote] = useState(0) |
|
|
|
|
|
|
|
useEffect(() => { |
|
|
|
|