fix: address code review findings

This commit is contained in:
2026-08-18 19:54:12 +03:00
parent 6e65e6161c
commit 502979d43b
3 changed files with 40 additions and 3 deletions

View File

@@ -239,6 +239,30 @@ func RouteSearch(hc *HandlerContext, w http.ResponseWriter, r *http.Request) {
}
}
// Detect closed stations by checking if they have real edges in the graph
for _, cityID := range []string{req.FromCityID, req.ToCityID} {
// Get stations for this city
stations := getStationsForCity(cityID)
for _, station := range stations {
if len(station) > 0 {
stationID := station[0]
// Check if this station has real edges
hasRealEdges := false
for _, edge := range hc.Router.Edges() {
if edge.From.ID == stationID || edge.To.ID == stationID {
if edge.Kind == routing.EdgeKindReal {
hasRealEdges = true
break
}
}
}
if !hasRealEdges {
closedStationsMap[stationID] = true
}
}
}
}
// Run Pareto-optimal route search using the graph
results := hc.Router.FindRoutesPareto(req.FromCityID, req.ToCityID, opts, closedStationsMap, neighborsMap)