Sfoglia il codice sorgente

Cambio en el ordenamiento de las distancias

gabriel 7 anni fa
parent
commit
a58b7d8ece
1 ha cambiato i file con 3 aggiunte e 3 eliminazioni
  1. 3 3
      src/FTTHBundle/Controller/ONUController.php

+ 3 - 3
src/FTTHBundle/Controller/ONUController.php

@@ -91,9 +91,9 @@ class ONUController extends Controller
                 if (isset($extraData['lat']) && isset($extraData['lng'])) {
                     $distance = $this->distanceGeoPoints($lat, $lng, $extraData['lat'], $extraData['lng'], true);
                     // divido por 1000 para pasarlo de metros a kilometros
-                    $naps[$nap->getId()] = ['id' => $nap->getId(), 'name' => $nap->getName(), 'distance' => $distance, 'freePort'=>$nap->getFreePort()];
+                    $naps[$nap->getId()] = ['id' => $nap->getId(), 'name' => $nap->getName(), 'distance' => $distance, 'freePort' => $nap->getFreePort()];
                 } else {
-                    $naps[$nap->getId()] = ['id' => $nap->getId(), 'name' => $nap->getName(), 'distance' => -1, 'freePort'=>$nap->getFreePort()];
+                    $naps[$nap->getId()] = ['id' => $nap->getId(), 'name' => $nap->getName(), 'distance' => -1, 'freePort' => $nap->getFreePort()];
                 }
             }
         }
@@ -107,6 +107,6 @@ class ONUController extends Controller
      */
     public function orderDistances($a, $b)
     {
-        return $a["distance"] - $b["distance"];
+        return $b["distance"] - $a["distance"];
     }
 }