Fix Request for ctegory stats
This commit is contained in:
parent
39cc5ef906
commit
9dc60ca0cd
|
@ -33,28 +33,28 @@ class category extends Repo_i{
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getStats(?int $id = null){
|
public function getStats(?int $id = null){
|
||||||
$st = $this->pdo->prepare("SELECT VHCours, VHTd, VHTp, Cat.idCategorie idCat, count(P.idProfesseur) nbrProf, Cat.labelCategorie labelCat
|
$st = $this->pdo->prepare("SELECT IFNULL(VHCours,0) VHCours, IFNULL(VHTd,0)VHTd, IFNULL(VHTp,0)VHTp, Cat.idCategorie idCat, count(P.idProfesseur) nbrProf, Cat.labelCategorie labelCat
|
||||||
FROM Categorie Cat
|
FROM Categorie Cat
|
||||||
LEFT JOIN (SELECT IFNULL(SUM(Cours.volume),0) VHCours, Prof.Categorie_idCategorie idCat
|
LEFT JOIN (SELECT IFNULL(SUM(Cours.volume),0) VHCours, Prof.Categorie_idCategorie idCat
|
||||||
FROM Professeur Prof
|
FROM Professeur Prof
|
||||||
LEFT JOIN Cours ON Prof.idProfesseur = Cours.Professeur_idProfesseur
|
LEFT JOIN Cours ON Prof.idProfesseur = Cours.Professeur_idProfesseur
|
||||||
JOIN UE U ON Cours.UE_code = U.code
|
LEFT JOIN UE U ON Cours.UE_code = U.code
|
||||||
WHERE U.disabled = 0
|
GROUP BY Prof.Categorie_idCategorie, U.disabled
|
||||||
GROUP BY Prof.Categorie_idCategorie) VHCours ON VHCours.idCat = Cat.idCategorie
|
HAVING U.disabled = 0) VHCours ON VHCours.idCat = Cat.idCategorie
|
||||||
|
|
||||||
LEFT JOIN (SELECT IFNULL(SUM(TD.volume),0) VHTd , Prof.Categorie_idCategorie idCat
|
LEFT JOIN (SELECT IFNULL(SUM(TD.volume),0) VHTd , Prof.Categorie_idCategorie idCat
|
||||||
FROM Professeur Prof
|
FROM Professeur Prof
|
||||||
LEFT JOIN TD ON TD.Professeur_idProfesseur = Prof.idProfesseur
|
LEFT JOIN TD ON TD.Professeur_idProfesseur = Prof.idProfesseur
|
||||||
JOIN UE U2 ON TD.UE_code = U2.code
|
LEFT JOIN UE U2 ON TD.UE_code = U2.code
|
||||||
WHERE U2.disabled = 0
|
GROUP BY Prof.Categorie_idCategorie, U2.disabled
|
||||||
GROUP BY Prof.Categorie_idCategorie) VHTd ON VHTd.idCat = Cat.idCategorie
|
HAVING U2.disabled = 0) VHTd ON VHTd.idCat = Cat.idCategorie
|
||||||
|
|
||||||
LEFT JOIN (SELECT IFNULL(SUM(TP.volume),0) VHTp, Prof.Categorie_idCategorie idCat
|
LEFT JOIN (SELECT IFNULL(SUM(TP.volume),0) VHTp, Prof.Categorie_idCategorie idCat
|
||||||
FROM Professeur Prof
|
FROM Professeur Prof
|
||||||
LEFT JOIN TP ON TP.Professeur_idProfesseur = Prof.idProfesseur
|
LEFT JOIN TP ON TP.Professeur_idProfesseur = Prof.idProfesseur
|
||||||
JOIN UE U3 ON TP.UE_code = U3.code
|
LEFT JOIN UE U3 ON TP.UE_code = U3.code
|
||||||
WHERE U3.disabled = 0
|
GROUP BY Prof.Categorie_idCategorie, U3.disabled
|
||||||
GROUP BY Prof.Categorie_idCategorie) VHTp ON VHTp.idCat = Cat.idCategorie
|
HAVING U3.disabled = 0) VHTp ON VHTp.idCat = Cat.idCategorie
|
||||||
LEFT JOIN Professeur P ON Cat.idCategorie = P.Categorie_idCategorie
|
LEFT JOIN Professeur P ON Cat.idCategorie = P.Categorie_idCategorie
|
||||||
".($id ? " WHERE Cat.idCategorie = :idCat" : "")."
|
".($id ? " WHERE Cat.idCategorie = :idCat" : "")."
|
||||||
GROUP BY Cat.idCategorie;");
|
GROUP BY Cat.idCategorie;");
|
||||||
|
|
|
@ -320,7 +320,12 @@ class professor extends Repo_i {
|
||||||
$prof['VHComp'] = ( $prof['VHComp'] < 0 ) ? 0 : $prof['VHComp'];
|
$prof['VHComp'] = ( $prof['VHComp'] < 0 ) ? 0 : $prof['VHComp'];
|
||||||
}else{
|
}else{
|
||||||
$VH["equiTD"] = $prof["VHTd"] + (2/3)*$prof["VHTp"] + 1.5*$prof["VHCours"];
|
$VH["equiTD"] = $prof["VHTd"] + (2/3)*$prof["VHTp"] + 1.5*$prof["VHCours"];
|
||||||
$prof['VHComp'] = null;
|
if(is_numeric($prof["hoursToDo"]) and $prof["hoursToDo"] > 0){
|
||||||
|
$prof['VHComp'] = round($prof['equiTD'] - $prof['hoursToDo'], 2);
|
||||||
|
$prof['VHComp'] = ( $prof['VHComp'] < 0 ) ? 0 : $prof['VHComp'];
|
||||||
|
}else{
|
||||||
|
$prof['VHComp'] = 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue