diff --git a/build/api/module/Excel.php b/build/api/module/Excel.php index 7540023..488d164 100644 --- a/build/api/module/Excel.php +++ b/build/api/module/Excel.php @@ -72,7 +72,15 @@ class Excel * declaring the lambda tha twill extract the list of formation involved in the group */ $getFormations = function(?string $group) use (&$formation,&$allFormations) : array{ - if(!$group) return [$formation]; + if(!$group){ + if(!isset($allFormations[$formation])){ + $allFormations[$formation] = [ + "name" => $formation, + "internal" => 1 + ]; + } + return [$formation]; + } //replace the generic "INFO" keyword by the actual formation $group = str_replace("INFO",$formation,$group); @@ -280,9 +288,9 @@ class Excel foreach ($UE["groups"] as $type => $groups){ foreach ($groups as $group){ $formations = []; - foreach ($group["formations"] as $form){ - if(isset($allFormations[$form]["dbId"])){ - $formations[] = $allFormations[$form]["dbId"]; + foreach ($group["formations"] as $format){ + if(isset($allFormations[$format]["dbId"])){ + $formations[] = $allFormations[$format]["dbId"]; } } @@ -306,14 +314,12 @@ class Excel $formations); break; } + } } - } } - - return [ 'data' => ["professors" => $allProf, "formations" => $allFormations, "UEs" => $allUE ] ]; }catch (Exception $e){ return [ 'error' => new Error(Err::UnknownError) ];