[repo.ue]Fix additionnals data computation

This commit is contained in:
Unknown 2018-03-29 23:51:15 +02:00
parent 5ea9d901a9
commit a79710f3fe
1 changed files with 50 additions and 46 deletions

View File

@ -180,7 +180,8 @@ class ue extends Repo_i {
$parm = is_null($code) ? [] : [':code' => $code];
/* (2) Prepare Statement */
$st = $this->pdo->prepare("SELECT
$st = $this->pdo->prepare("
SELECT
ue.code,
ue.label,
ue.disabled,
@ -194,9 +195,9 @@ class ue extends Repo_i {
IFNULL(formlist.nbrCours,0) nbrCours,
IFNULL(formlist.nbrTD,0) nbrTD,
IFNULL(formlist.nbrTP,0) nbrTP,
IFNULL(formlist.modCours,0) modCours,
IFNULL(formlist.modTD,0) modTD,
IFNULL(formlist.modTP,0) modTP,
IFNULL(formlist.modCours,1) modCours,
IFNULL(formlist.modTD,1) modTD,
IFNULL(formlist.modTP,1) modTP,
IFNULL(formlist.nbrProfCours,0) nbrProfCours,
IFNULL(formlist.nbrProfTD,0) nbrProfTD,
IFNULL(formlist.nbrProfTP,0) nbrProfTP
@ -205,13 +206,16 @@ class ue extends Repo_i {
LEFT JOIN (
SELECT ue2.code code, CONCAT('[',GROUP_CONCAT(DISTINCT Formation.idFormation), ']') formations,
count(DISTINCT C.idCours) nbrCours, count(DISTINCT T.idTD) nbrTD, count(DISTINCT T2.idTP) nbrTP,
MOD(sum(DISTINCT C.volume),ue2.volumeCours) modCours,
MOD(sum(DISTINCT T.volume),ue2.volumeTD) modTD,
MOD(sum(DISTINCT T2.volume),ue2.volumeTP) modTP,
count(DISTINCT C.Professeur_idProfesseur) nbrProfCours,
count(DISTINCT T.Professeur_idProfesseur) nbrProfTD,
count(DISTINCT T2.Professeur_idProfesseur) nbrProfTP
MOD(volC.vol,ue2.volumeCours) modCours,
MOD(volTD.vol,ue2.volumeTD) modTD,
MOD(volTP.vol,ue2.volumeTP) modTP,
count(DISTINCT C.Professeur_idProfesseur,C.idCours) nbrProfCours,
count(DISTINCT T.Professeur_idProfesseur,T.idTD) nbrProfTD,
count(DISTINCT T2.Professeur_idProfesseur,T2.idTP) nbrProfTP
FROM UE ue2
LEFT JOIN (SELECT sum(CO.volume) vol, CO.UE_code FROM Cours CO GROUP BY CO.UE_code) volC ON ue2.code = volC.UE_code
LEFT JOIN (SELECT sum(TD2.volume) vol, TD2.UE_code FROM TD TD2 GROUP BY TD2.UE_code) volTD ON ue2.code = volTD.UE_code
LEFT JOIN (SELECT sum(TP2.volume) vol, TP2.UE_code FROM TP TP2 GROUP BY TP2.UE_code) volTP ON ue2.code = volTP.UE_code
LEFT JOIN Cours C ON ue2.code = C.UE_code
LEFT JOIN TD T ON ue2.code = T.UE_code
LEFT JOIN TP T2 ON ue2.code = T2.UE_code