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