Browse Source

réectification de moyenne

master
andrymodeste 3 weeks ago
parent
commit
616b16ae29
  1. 50
      src/renderer/src/components/ReleverNotes.jsx
  2. 16
      src/renderer/src/components/function/PDFEditorCertificate.js

50
src/renderer/src/components/ReleverNotes.jsx

@ -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) => {
TotalNoteNumber += Number(notes.textContent) / totalNotesNormale.length
})
totalNotesRattrapage.forEach((notes) => {
TotalNoteNumberRepech += Number(notes.textContent) / totalNotesRattrapage.length
})
// Retourner la note selon le type de session
if (sessionType === 'normale') { if (sessionType === 'normale') {
return TotalNoteNumber // 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') { } else if (sessionType === 'rattrapage') {
return TotalNoteNumberRepech // 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 { } else {
// Pour 'ensemble', prendre la meilleure note // Pour 'ensemble', prendre la meilleure note entre normale et rattrapage pour chaque matière
return Math.max(TotalNoteNumber, TotalNoteNumberRepech) 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
} }
})
} }
return totalCredits > 0 ? totalNotesPonderees / totalCredits : 0
}
const [note, setNote] = useState(0) const [note, setNote] = useState(0)
useEffect(() => { useEffect(() => {

16
src/renderer/src/components/function/PDFEditorCertificate.js

@ -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…
Cancel
Save