fix: address code review findings
This commit is contained in:
@@ -28,7 +28,6 @@ type Metrics struct {
|
||||
|
||||
// histogram tracks duration values and computes simple stats.
|
||||
type histogram struct {
|
||||
mu sync.Mutex
|
||||
values []int64 // nanoseconds
|
||||
maxValues int
|
||||
}
|
||||
|
||||
@@ -915,7 +915,7 @@ type SearchResult struct {
|
||||
// route in all three metrics simultaneously. Routes are sorted according to the RankingMode
|
||||
// in SearchOptions: "fastest" (default, by duration), "fewest_transfers" (by transfers),
|
||||
// or "cheapest" (by cost).
|
||||
func (g *Graph) FindRoutesPareto(originID, destID string, opts SearchOptions, closedStations map[string]bool, neighbors map[string][]storage.StationNeighbor) []*Itinerary {
|
||||
func (g *Graph) FindRoutesPareto(originID, destID string, opts SearchOptions, closedStations map[string]bool, neighbors map[string][]storage.StationNeighbor, yclient ...*yandex.Client) []*Itinerary {
|
||||
// Run multiple searches with different strategies to find diverse routes
|
||||
var allItineraries []*Itinerary
|
||||
|
||||
@@ -925,7 +925,7 @@ func (g *Graph) FindRoutesPareto(originID, destID string, opts SearchOptions, cl
|
||||
optsCopy := opts
|
||||
optsCopy.MaxTransfers = 5
|
||||
|
||||
result := g.FindRoute(originID, destID, optsCopy, closedStations, neighbors)
|
||||
result := g.FindRoute(originID, destID, optsCopy, closedStations, neighbors, yclient...)
|
||||
if result != nil && result.TotalDuration > 0 {
|
||||
allItineraries = append(allItineraries, result)
|
||||
}
|
||||
@@ -934,7 +934,7 @@ func (g *Graph) FindRoutesPareto(originID, destID string, opts SearchOptions, cl
|
||||
optsCopy := opts
|
||||
optsCopy.MaxTransfers = maxTransfers
|
||||
|
||||
result := g.FindRoute(originID, destID, optsCopy, closedStations, neighbors)
|
||||
result := g.FindRoute(originID, destID, optsCopy, closedStations, neighbors, yclient...)
|
||||
if result != nil && result.TotalDuration > 0 {
|
||||
allItineraries = append(allItineraries, result)
|
||||
}
|
||||
|
||||
@@ -241,8 +241,8 @@ async function searchRoutes(formData) {
|
||||
'Content-Type': 'application/json'
|
||||
},
|
||||
body: JSON.stringify({
|
||||
from: formData.get('from'),
|
||||
to: formData.get('to'),
|
||||
from_city_id: formData.get('from'),
|
||||
to_city_id: formData.get('to'),
|
||||
date: formData.get('date')
|
||||
})
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user