diff --git a/build/api/module/professorController.php b/build/api/module/professorController.php index b7f0b69..2ad71af 100644 --- a/build/api/module/professorController.php +++ b/build/api/module/professorController.php @@ -20,8 +20,8 @@ class professorController{ private static function proccess_vh(array &$vh_prof){ /* (1) If not in category 1 nor 3 -> equivalentTD = TD + 2/3.TP + 1.5.COURS */ - 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']; + 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'] ); // 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']; /* (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) */ - $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) */ $vh_prof['equiTD'] = round(1.5*$vh_prof['VHCours'] + $vh_prof['VHTd'] + $valTP + ($vh_prof['VHTp'] - $valTP)*(2/3), 2); } /* (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']; } @@ -53,7 +53,7 @@ class professorController{ ---------------------------------------------------------*/ public static function get($args){ $prof_id = null; - $with_vh = ''; + $with_vh = 0; extract($args); /* Get the professor repo */ @@ -63,7 +63,7 @@ class professorController{ /* (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) */ $fetched = $prof_repo->getWithVH($prof_id);