[notes] Display of max

This commit is contained in:
mckmonster 2024-09-11 09:27:45 +02:00
parent 2fb6059eeb
commit b3753e503c
3 changed files with 11 additions and 7 deletions

View file

@ -41,7 +41,7 @@ class Matiere {
$total = 0; $total = 0;
$totalCoef = 0.0; $totalCoef = 0.0;
foreach ($this->notes as $note) { foreach ($this->notes as $note) {
$total += $note->getNote() * $note->getCoef(); $total += $note->getNoteOn20() * $note->getCoef();
$totalCoef += $note->getCoef(); $totalCoef += $note->getCoef();
} }
return $total / $totalCoef; return $total / $totalCoef;

View file

@ -23,6 +23,10 @@ class Note {
return $this->note; return $this->note;
} }
public function getNoteOn20() {
return ($this->note / $this->max) * 20;
}
public function getCoef() { public function getCoef() {
return $this->coef; return $this->coef;
} }

View file

@ -7,7 +7,7 @@
<div class="row"> <div class="row">
<div class="col-sm-10"></div> <div class="col-sm-10"></div>
<div class="col-sm-2"> <div class="col-sm-2">
Moyenne : {{ matiere.getMoyenne() }} Moyenne : {{ matiere.getMoyenne() }} / 20
</div> </div>
</div> </div>
</div> </div>
@ -15,13 +15,13 @@
{% for note in matiere.getNotes() %} {% for note in matiere.getNotes() %}
<div class="row"> <div class="row">
<div class="col-sm-1"> <div class="col-sm-1">
{% if note.getNote() >= 20 %} {% if note.getNoteOn20() >= 20 %}
<i class="fa fa-star" style="color:gold"></i> <i class="fa fa-star" style="color:gold"></i>
{% elseif note.getNote() >= 15 %} {% elseif note.getNoteOn20() >= 15 %}
<i class="fa fa-heart" style="color:red"></i> <i class="fa fa-heart" style="color:red"></i>
{% elseif note.getNote() >= 12 %} {% elseif note.getNoteOn20() >= 12 %}
<i class="fa fa-smile" style="color:green"></i> <i class="fa fa-smile" style="color:green"></i>
{% elseif note.getNote() >= 9 %} {% elseif note.getNoteOn20() >= 9 %}
<i class="fa fa-thumbs-up" style="color:green"></i> <i class="fa fa-thumbs-up" style="color:green"></i>
{% endif %} {% endif %}
</div> </div>
@ -29,7 +29,7 @@
{{ note.getIntitule() }} {{ note.getIntitule() }}
</div> </div>
<div class="col-sm-1"> <div class="col-sm-1">
{{ note.getNote() }} {{ note.getNote() }} / {{ note.getMax() }}
</div> </div>
</div> </div>
{% endfor %} {% endfor %}