This commit is contained in:
xdrm-brackets 2017-09-25 23:28:56 +02:00
parent f15db0a3a9
commit 97c7b8474b
2 changed files with 10 additions and 9 deletions

View File

@ -499,17 +499,17 @@
$chips = ($chipsReq->error->get()==Err::Success) ? $chipsReq->answer() : [];
foreach($chips as $c=>$chip){
foreach($chips as &$chip){
/* [5] On récupére la liste des PINS de chaque PUCE
=========================================================*/
$chips[$c]['pins'] = explode(',', $chip['pins']);
$chip['pins'] = explode(',', $chip['pins']);
if( !is_array($chip['pins']) )
$chips[$c]['pins'] = [];
$chip['pins'] = [];
/* [6] On récupère valeurs pour chaque état de chaque PUCE
=========================================================*/
$chips[$c]['states'] = [];
$chip['states'] = [];
$statesReq = new Repo('state/getForChip', [$chip['id_chip']]);
$states = ($statesReq->error->get()==Err::Success) ? $statesReq->answer() : [];
@ -517,9 +517,10 @@
// On met en forme les données : "val1,val2,val3" -> [val1, val2, val3]
foreach($states as $s=>$state){
$chips[$c]['states'][$state['state']] = explode(',', $state['value']);
foreach($chips[$c]['states'][$state['state']] as $s2=>$state2)
$chips[$c]['states'][$state['state']][$s2] = intval($state2);
$chip['states'][$state['state']] = explode(',', $state['value']);
foreach($chip['states'][$state['state']] as $s2=>$state2)
$chip['states'][$state['state']][$s2] = intval($state2);
}
}

View File

@ -61,9 +61,9 @@
->select('*')
->whereIdModule($module_id);
$fetched = $chip_req->fetch();
$chip_fetched = $chip_req->fetch();
foreach($fetched as $chip)
foreach($chip_fetched as $chip)
$chips[] = $chip;
}