[module.professor] GET fixed VH formula (renamed 'du' to 'hoursToDo')

This commit is contained in:
xdrm-brackets 2018-03-05 19:42:37 +01:00
parent 92dfdbbc5b
commit 15c57b7abb
1 changed files with 7 additions and 7 deletions

View File

@ -20,8 +20,8 @@ class professorController{
private static function proccess_vh(array &$vh_prof){ private static function proccess_vh(array &$vh_prof){
/* (1) If not in category 1 nor 3 -> equivalentTD = TD + 2/3.TP + 1.5.COURS */ /* (1) If not in category 1 nor 3 -> equivalentTD = TD + 2/3.TP + 1.5.COURS */
if( !in_array($vh_prof['idCat'], [1,3]) ) if( !in_array($vh_prof['idCat'], [1, 3]) )
return $vh_prof['equiTD'] = $vh_prof['VHTd'] + (2/3)*$vh_prof['VHTp'] + 1.5*$vh_prof['VHCours']; return ( $vh_prof['equiTD'] = $vh_prof['VHTd'] + (2/3)*$vh_prof['VHTp'] + 1.5*$vh_prof['VHCours'] );
// exited because of 'return' statement // exited because of 'return' statement
@ -29,17 +29,17 @@ class professorController{
$vh_prof['equiTD'] = $vh_prof['VHTd'] + $vh_prof['VHTp'] + 1.5*$vh_prof['VHCours']; $vh_prof['equiTD'] = $vh_prof['VHTd'] + $vh_prof['VHTp'] + 1.5*$vh_prof['VHCours'];
/* (3) If equivalentTD exceeds HeuresDues */ /* (3) If equivalentTD exceeds HeuresDues */
if($vh_prof['equiTD'] > $vh_prof['du']){ if($vh_prof['equiTD'] > $vh_prof['hoursToDo']){
/* (3.1) @valTP = HeuresDues.(TP / equivalentTD) */ /* (3.1) @valTP = HeuresDues.(TP / equivalentTD) */
$valTP = $vh_prof['du'] * ( $vh_prof['VHTp'] / $vh_prof['equiTD'] ); $valTP = $vh_prof['hoursToDo'] * ( $vh_prof['VHTp'] / $vh_prof['equiTD'] );
/* (3.2) equivalentTD = 1.5*COURS + TD + @valTP + (TP-@valTP) */ /* (3.2) equivalentTD = 1.5*COURS + TD + @valTP + (TP-@valTP) */
$vh_prof['equiTD'] = round(1.5*$vh_prof['VHCours'] + $vh_prof['VHTd'] + $valTP + ($vh_prof['VHTp'] - $valTP)*(2/3), 2); $vh_prof['equiTD'] = round(1.5*$vh_prof['VHCours'] + $vh_prof['VHTd'] + $valTP + ($vh_prof['VHTp'] - $valTP)*(2/3), 2);
} }
/* (4) VH comp */ /* (4) VH comp */
$vh_prof['VHComp'] = round($vh_prof['equiTD'] - $vh_prof['du'], 2); $vh_prof['VHComp'] = round($vh_prof['equiTD'] - $vh_prof['hoursToDo'], 2);
$vh_prof['VHComp'] = ( $vh_prof['VHComp'] < 0 ) ? 0 : $vh_prof['VHComp']; $vh_prof['VHComp'] = ( $vh_prof['VHComp'] < 0 ) ? 0 : $vh_prof['VHComp'];
} }
@ -53,7 +53,7 @@ class professorController{
---------------------------------------------------------*/ ---------------------------------------------------------*/
public static function get($args){ public static function get($args){
$prof_id = null; $prof_id = null;
$with_vh = ''; $with_vh = 0;
extract($args); extract($args);
/* Get the professor repo */ /* Get the professor repo */
@ -63,7 +63,7 @@ class professorController{
/* (1) If with VH data /* (1) If with VH data
---------------------------------------------------------*/ ---------------------------------------------------------*/
if( is_string($with_vh) && $with_vh == '1' ){ if( is_int($with_vh) && $with_vh === 1 ){
/* (1) Get All professors or 1 by its id (if set) */ /* (1) Get All professors or 1 by its id (if set) */
$fetched = $prof_repo->getWithVH($prof_id); $fetched = $prof_repo->getWithVH($prof_id);