From b3753e503c4ecae0fe405fc4dcdb03ea5d1872d8 Mon Sep 17 00:00:00 2001 From: mckmonster Date: Wed, 11 Sep 2024 09:27:45 +0200 Subject: [PATCH] [notes] Display of max --- libs/bulletin/Matiere.lib.php | 2 +- libs/bulletin/Note.lib.php | 4 ++++ templates/eleve_notes.twig | 12 ++++++------ 3 files changed, 11 insertions(+), 7 deletions(-) diff --git a/libs/bulletin/Matiere.lib.php b/libs/bulletin/Matiere.lib.php index ba5d9a8..29327b5 100644 --- a/libs/bulletin/Matiere.lib.php +++ b/libs/bulletin/Matiere.lib.php @@ -41,7 +41,7 @@ class Matiere { $total = 0; $totalCoef = 0.0; foreach ($this->notes as $note) { - $total += $note->getNote() * $note->getCoef(); + $total += $note->getNoteOn20() * $note->getCoef(); $totalCoef += $note->getCoef(); } return $total / $totalCoef; diff --git a/libs/bulletin/Note.lib.php b/libs/bulletin/Note.lib.php index 3cf7b5e..ac0a4c0 100644 --- a/libs/bulletin/Note.lib.php +++ b/libs/bulletin/Note.lib.php @@ -23,6 +23,10 @@ class Note { return $this->note; } + public function getNoteOn20() { + return ($this->note / $this->max) * 20; + } + public function getCoef() { return $this->coef; } diff --git a/templates/eleve_notes.twig b/templates/eleve_notes.twig index 20c342b..aa048ca 100644 --- a/templates/eleve_notes.twig +++ b/templates/eleve_notes.twig @@ -7,7 +7,7 @@
- Moyenne : {{ matiere.getMoyenne() }} + Moyenne : {{ matiere.getMoyenne() }} / 20
@@ -15,13 +15,13 @@ {% for note in matiere.getNotes() %}
- {% if note.getNote() >= 20 %} + {% if note.getNoteOn20() >= 20 %} - {% elseif note.getNote() >= 15 %} + {% elseif note.getNoteOn20() >= 15 %} - {% elseif note.getNote() >= 12 %} + {% elseif note.getNoteOn20() >= 12 %} - {% elseif note.getNote() >= 9 %} + {% elseif note.getNoteOn20() >= 9 %} {% endif %}
@@ -29,7 +29,7 @@ {{ note.getIntitule() }}
- {{ note.getNote() }} + {{ note.getNote() }} / {{ note.getMax() }}
{% endfor %}