From 3cd9b819f5d8d702ea8764db31c0ff04a609fcd0 Mon Sep 17 00:00:00 2001 From: Dmitry Popov Date: Tue, 20 May 2025 15:31:38 +0200 Subject: [PATCH] chore(Map): Added ping system to routes --- .../map/event_handlers/map_routes_event_handler.ex | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/lib/wanderer_app_web/live/map/event_handlers/map_routes_event_handler.ex b/lib/wanderer_app_web/live/map/event_handlers/map_routes_event_handler.ex index 0a37563f..d7d98dd5 100644 --- a/lib/wanderer_app_web/live/map/event_handlers/map_routes_event_handler.ex +++ b/lib/wanderer_app_web/live/map/event_handlers/map_routes_event_handler.ex @@ -56,13 +56,21 @@ defmodule WandererAppWeb.MapRoutesEventHandler do {:ok, hubs} = map_id |> WandererApp.Map.list_hubs() + {:ok, pings} = WandererApp.MapPingsRepo.get_by_map(map_id) + + ping_system_ids = + pings + |> Enum.map(fn %{system: %{solar_system_id: solar_system_id}} -> "#{solar_system_id}" end) + + route_hubs = (ping_system_ids ++ hubs) |> Enum.uniq() + is_hubs_limit_reached = hubs |> Enum.count() > hubs_limit Task.async(fn -> {:ok, routes} = WandererApp.Maps.find_routes( map_id, - hubs, + route_hubs, solar_system_id, get_routes_settings(routes_settings), is_hubs_limit_reached