From d9d79447ffd2eedd5570233a213f429e7605b0bd Mon Sep 17 00:00:00 2001 From: Ruben Date: Thu, 3 Nov 2016 01:12:21 +0100 Subject: [PATCH] Fix images fixed order --- src/Api/InterfaceControllerProvider.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Api/InterfaceControllerProvider.php b/src/Api/InterfaceControllerProvider.php index 86c73a4..1c08fdf 100644 --- a/src/Api/InterfaceControllerProvider.php +++ b/src/Api/InterfaceControllerProvider.php @@ -29,17 +29,19 @@ class InterfaceControllerProvider implements ControllerProviderInterface $getEmoBlocks = function($emotion, $feature, $steps = 6) { $hitRepo = $this->_eh->getEm()->getRepository(Models\Hit::class); $blocks = []; + $a = 1; foreach(range(0, 100, 100/($steps-1)) as $i) { /* @var $hitRepo EmotionHero\Models\HitRepository */ $hit = $hitRepo->getClosestHitWithImage($emotion, $i); $img = "data:image/x-icon;base64,".$hit->getFeatureImgAsString($feature); $score = $hit->getEmotions()->getEmotionScore($emotion); $percentage = sprintf("%.0f %%",$score); - $blocks[$i] = [ + $blocks[$a] = [ 'hit_id' => $hit->getId(), 'img_data' => $img, 'percentage' => $percentage, ]; + $a++; } return $blocks; };