diff --git a/backend/src/Controller/SpotScoreController.php b/backend/src/Controller/SpotScoreController.php index fc89a6d..672b8a4 100644 --- a/backend/src/Controller/SpotScoreController.php +++ b/backend/src/Controller/SpotScoreController.php @@ -121,7 +121,9 @@ class SpotScoreController extends AbstractController coastal_point cp3 WHERE cp3.id = :spotId AND ST_Distance(o2.geometry::geography, cp3.geometry::geography) < 300000 - ORDER BY o2.detected_at DESC LIMIT 1 + ORDER BY ST_Distance(o2.geometry::geography, cp3.geometry::geography) ASC, + o2.detected_at DESC + LIMIT 1 ) ORDER BY f.time_horizon ASC', ['spotId' => $spotId] @@ -243,7 +245,9 @@ class SpotScoreController extends AbstractController coastal_point cp3 WHERE cp3.id = :spotId AND ST_Distance(o2.geometry::geography, cp3.geometry::geography) < 300000 - ORDER BY o2.detected_at DESC LIMIT 1 + ORDER BY ST_Distance(o2.geometry::geography, cp3.geometry::geography) ASC, + o2.detected_at DESC + LIMIT 1 ) ) dump WHERE cp.id = :spotId