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
|
// MODIFICATION: Fonction totalNotes mise à jour pour utiliser les nouvelles classes
|
||||||
const totalNotes = () => {
|
// Remplacer la fonction totalNotes() dans ReleverNotes.jsx par celle-ci :
|
||||||
let totalNotesNormale = document.querySelectorAll('.moyenneUENormale')
|
|
||||||
let totalNotesRattrapage = document.querySelectorAll('.moyenneUERattrapage')
|
|
||||||
|
|
||||||
let TotalNoteNumber = 0
|
const totalNotes = () => {
|
||||||
let TotalNoteNumberRepech = 0
|
// Calculer la moyenne pondérée par les crédits selon le type de session
|
||||||
|
let totalNotesPonderees = 0
|
||||||
|
let totalCredits = 0
|
||||||
|
|
||||||
totalNotesNormale.forEach((notes) => {
|
if (sessionType === 'normale') {
|
||||||
TotalNoteNumber += Number(notes.textContent) / totalNotesNormale.length
|
// Utiliser uniquement les notes normales
|
||||||
|
matiereWithSemestre.forEach((matiere) => {
|
||||||
|
if (matiere.note != null && !isNaN(matiere.note)) {
|
||||||
|
totalNotesPonderees += matiere.note * matiere.credit
|
||||||
|
totalCredits += matiere.credit
|
||||||
|
}
|
||||||
})
|
})
|
||||||
|
} else if (sessionType === 'rattrapage') {
|
||||||
totalNotesRattrapage.forEach((notes) => {
|
// Utiliser uniquement les notes de rattrapage
|
||||||
TotalNoteNumberRepech += Number(notes.textContent) / totalNotesRattrapage.length
|
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)
|
||||||
|
|
||||||
// Retourner la note selon le type de session
|
if (bestNote > 0) {
|
||||||
if (sessionType === 'normale') {
|
totalNotesPonderees += bestNote * matiere.credit
|
||||||
return TotalNoteNumber
|
totalCredits += matiere.credit
|
||||||
} 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)
|
const [note, setNote] = useState(0)
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
|||||||
@ -14,14 +14,14 @@ const PDFEditorCertificat = async (data) => {
|
|||||||
|
|
||||||
function writeniveau(niveaus) {
|
function writeniveau(niveaus) {
|
||||||
const niveauxMap = {
|
const niveauxMap = {
|
||||||
L1: '1e année de licences',
|
L1: '1er année de licence',
|
||||||
L2: '2e année de licences',
|
L2: '2ème année de licence',
|
||||||
L3: '3e année de licences',
|
L3: '3ème année de licence',
|
||||||
M1: '1e année de master',
|
M1: '1er année de master',
|
||||||
M2: '2e année de master',
|
M2: '2ème année de master',
|
||||||
D1: '1e année en doctorat',
|
D1: '1er année en doctorat',
|
||||||
D2: '2e année en doctorat',
|
D2: '2ème année en doctorat',
|
||||||
D3: '3e année en doctorat'
|
D3: '3ème année en doctorat'
|
||||||
}
|
}
|
||||||
return niveauxMap[niveaus] || 'Niveau inconnu'
|
return niveauxMap[niveaus] || 'Niveau inconnu'
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user