Improve passenger pickup/drop handling
Some checks failed
Build and Push Docker Image / build_and_push (push) Failing after 3m8s
Some checks failed
Build and Push Docker Image / build_and_push (push) Failing after 3m8s
This commit is contained in:
@@ -6,6 +6,7 @@ import (
|
||||
|
||||
"git.coopgo.io/coopgo-platform/carpool-service/servers/grpc/proto"
|
||||
"github.com/paulmach/orb"
|
||||
"github.com/paulmach/orb/geojson"
|
||||
"github.com/rs/zerolog/log"
|
||||
"google.golang.org/grpc/codes"
|
||||
"google.golang.org/grpc/status"
|
||||
@@ -16,6 +17,24 @@ func (s *CarpoolServiceServerImpl) DriverJourneys(ctx context.Context, req *prot
|
||||
departure := orb.Point{req.DepartureLng, req.DepartureLat}
|
||||
arrival := orb.Point{req.ArrivalLng, req.ArrivalLat}
|
||||
|
||||
// Create features with addresses
|
||||
departureFeature := geojson.NewFeature(departure)
|
||||
arrivalFeature := geojson.NewFeature(arrival)
|
||||
|
||||
if req.DepartureAddress != nil && *req.DepartureAddress != "" {
|
||||
if departureFeature.Properties == nil {
|
||||
departureFeature.Properties = make(map[string]interface{})
|
||||
}
|
||||
departureFeature.Properties["label"] = *req.DepartureAddress
|
||||
}
|
||||
|
||||
if req.ArrivalAddress != nil && *req.ArrivalAddress != "" {
|
||||
if arrivalFeature.Properties == nil {
|
||||
arrivalFeature.Properties = make(map[string]interface{})
|
||||
}
|
||||
arrivalFeature.Properties["label"] = *req.ArrivalAddress
|
||||
}
|
||||
|
||||
log.Debug().
|
||||
Str("departure date", req.DepartureDate.String()).
|
||||
Any("departure", departure).
|
||||
@@ -39,7 +58,7 @@ func (s *CarpoolServiceServerImpl) DriverJourneys(ctx context.Context, req *prot
|
||||
Int64("td", int64(td)).
|
||||
Msg("DriverJourneys show dates")
|
||||
|
||||
journeys, err := s.Handler.GetDriverJourneys(departure, arrival, req.DepartureRadius, req.ArrivalRadius, minDate, maxDate, req.Count)
|
||||
journeys, err := s.Handler.GetDriverJourneys(departureFeature, arrivalFeature, req.DepartureRadius, req.ArrivalRadius, minDate, maxDate, req.Count)
|
||||
if err != nil {
|
||||
log.Error().Err(err).Msg("error finding driver journeys")
|
||||
return nil, err
|
||||
|
||||
Reference in New Issue
Block a user