Correction incohérence entre moyenne contrôle de la liste des contrôles ET les détails d'un contrôle
This commit is contained in:
parent
f83b0963fe
commit
499d17346c
|
@ -548,6 +548,7 @@ class DataBase{
|
||||||
$UEList[$iter_ue]['modules'][$iter_mod]['controles'][$iter_ct]['grouplist'] = noteRepo::forTeacher($UEList[$iter_ue]['modules'][$iter_mod]['controles'][$iter_ct]['id']);
|
$UEList[$iter_ue]['modules'][$iter_mod]['controles'][$iter_ct]['grouplist'] = noteRepo::forTeacher($UEList[$iter_ue]['modules'][$iter_mod]['controles'][$iter_ct]['id']);
|
||||||
|
|
||||||
$UEList[$iter_ue]['modules'][$iter_mod]['controles'][$iter_ct]['moyenne'] = noteRepo::moyenneForControle($UEList[$iter_ue]['modules'][$iter_mod]['controles'][$iter_ct]['id']);
|
$UEList[$iter_ue]['modules'][$iter_mod]['controles'][$iter_ct]['moyenne'] = noteRepo::moyenneForControle($UEList[$iter_ue]['modules'][$iter_mod]['controles'][$iter_ct]['id']);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -568,10 +569,8 @@ class DataBase{
|
||||||
// on récupère les informations du contrôle
|
// on récupère les informations du contrôle
|
||||||
if( ! ($controlObj=controleRepo::info($controle)) ) return 'unknown_controle';
|
if( ! ($controlObj=controleRepo::info($controle)) ) return 'unknown_controle';
|
||||||
|
|
||||||
if( $moyenneObj = noteRepo::moyenneForControle($controle) )
|
// on ajoute la moyenne au contrôle
|
||||||
$controlObj['moyenne'] = $moyenneObj['moyenne'];
|
$controlObj['moyenne'] = noteRepo::moyenneForControle($controlObj['id']);
|
||||||
else
|
|
||||||
$controlObj['moyenne'] = null;
|
|
||||||
|
|
||||||
/* [1] si le groupe est donné
|
/* [1] si le groupe est donné
|
||||||
=======================================*/
|
=======================================*/
|
||||||
|
|
|
@ -198,7 +198,7 @@ class noteRepo extends DBAccess{
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public static function moyenneForControle($controle){
|
public static function moyenneForControle($controle){
|
||||||
$getMoyenne = DataBase::getPDO()->prepare("SELECT AVG(n.valeur) as moyenne ".
|
$getMoyenne = DataBase::getPDO()->prepare("SELECT ctrl.id_controle, AVG(n.valeur) as moyenne ".
|
||||||
"FROM controle as ctrl, note as n ".
|
"FROM controle as ctrl, note as n ".
|
||||||
"WHERE ctrl.id_controle = n.id_controle ".
|
"WHERE ctrl.id_controle = n.id_controle ".
|
||||||
"AND ctrl.id_controle = :controle ".
|
"AND ctrl.id_controle = :controle ".
|
||||||
|
|
Loading…
Reference in New Issue