From 97c7b8474bf2acab3a0cfd642f8297d00769757e Mon Sep 17 00:00:00 2001 From: xdrm-brackets Date: Mon, 25 Sep 2017 23:28:56 +0200 Subject: [PATCH] minmod --- build/api/module/machineDefault.php | 15 ++++++++------- build/database/repo/chip.php | 4 ++-- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/build/api/module/machineDefault.php b/build/api/module/machineDefault.php index 1517b3a..bfd10f8 100755 --- a/build/api/module/machineDefault.php +++ b/build/api/module/machineDefault.php @@ -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); } } diff --git a/build/database/repo/chip.php b/build/database/repo/chip.php index 1a85c66..5e1f482 100755 --- a/build/database/repo/chip.php +++ b/build/database/repo/chip.php @@ -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; }