fix mising formations and groups
This commit is contained in:
parent
3e1ab4796c
commit
58d0a5ee14
|
@ -72,7 +72,15 @@ class Excel
|
||||||
* declaring the lambda tha twill extract the list of formation involved in the group
|
* declaring the lambda tha twill extract the list of formation involved in the group
|
||||||
*/
|
*/
|
||||||
$getFormations = function(?string $group) use (&$formation,&$allFormations) : array{
|
$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
|
//replace the generic "INFO" keyword by the actual formation
|
||||||
$group = str_replace("INFO",$formation,$group);
|
$group = str_replace("INFO",$formation,$group);
|
||||||
|
@ -280,9 +288,9 @@ class Excel
|
||||||
foreach ($UE["groups"] as $type => $groups){
|
foreach ($UE["groups"] as $type => $groups){
|
||||||
foreach ($groups as $group){
|
foreach ($groups as $group){
|
||||||
$formations = [];
|
$formations = [];
|
||||||
foreach ($group["formations"] as $form){
|
foreach ($group["formations"] as $format){
|
||||||
if(isset($allFormations[$form]["dbId"])){
|
if(isset($allFormations[$format]["dbId"])){
|
||||||
$formations[] = $allFormations[$form]["dbId"];
|
$formations[] = $allFormations[$format]["dbId"];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -306,14 +314,12 @@ class Excel
|
||||||
$formations);
|
$formations);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
return [ 'data' => ["professors" => $allProf, "formations" => $allFormations, "UEs" => $allUE ] ];
|
return [ 'data' => ["professors" => $allProf, "formations" => $allFormations, "UEs" => $allUE ] ];
|
||||||
}catch (Exception $e){
|
}catch (Exception $e){
|
||||||
return [ 'error' => new Error(Err::UnknownError) ];
|
return [ 'error' => new Error(Err::UnknownError) ];
|
||||||
|
|
Loading…
Reference in New Issue