réectification de moyenne
This commit is contained in:
parent
bd0999dce6
commit
616b16ae29
@ -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')
|
||||
// Remplacer la fonction totalNotes() dans ReleverNotes.jsx par celle-ci :
|
||||
|
||||
let TotalNoteNumber = 0
|
||||
let TotalNoteNumberRepech = 0
|
||||
const totalNotes = () => {
|
||||
// Calculer la moyenne pondérée par les crédits selon le type de session
|
||||
let totalNotesPonderees = 0
|
||||
let totalCredits = 0
|
||||
|
||||
totalNotesNormale.forEach((notes) => {
|
||||
TotalNoteNumber += Number(notes.textContent) / totalNotesNormale.length
|
||||
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(() => {
|
||||
|
||||
@ -14,14 +14,14 @@ const PDFEditorCertificat = async (data) => {
|
||||
|
||||
function writeniveau(niveaus) {
|
||||
const niveauxMap = {
|
||||
L1: '1e année de licences',
|
||||
L2: '2e année de licences',
|
||||
L3: '3e année de licences',
|
||||
M1: '1e année de master',
|
||||
M2: '2e année de master',
|
||||
D1: '1e année en doctorat',
|
||||
D2: '2e année en doctorat',
|
||||
D3: '3e année en doctorat'
|
||||
L1: '1er année de licence',
|
||||
L2: '2ème année de licence',
|
||||
L3: '3ème année de licence',
|
||||
M1: '1er année de master',
|
||||
M2: '2ème année de master',
|
||||
D1: '1er année en doctorat',
|
||||
D2: '2ème année en doctorat',
|
||||
D3: '3ème année en doctorat'
|
||||
}
|
||||
return niveauxMap[niveaus] || 'Niveau inconnu'
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user