functional testing gRPC fixes

This commit is contained in:
sbouaram 2023-10-20 15:53:43 +02:00
parent 251a3ef607
commit 513b048e49
2 changed files with 7 additions and 1 deletions

View File

@ -168,7 +168,7 @@ func (s *SolidarityServiceServerImpl) CreateBooking(ctx context.Context, req *pr
ID: req.Booking.Id,
Passenger_id: req.Booking.PassengerId,
Driver_id: req.Booking.DriverId,
Status: internal.BookingStatus(req.Booking.Status),
Status: internal.BookingStatus(req.Booking.Status.String()),
}
passenger, driver, err := s.Handler.CreateBooking(context.Background(), bookingRequest)
if err != nil {
@ -180,6 +180,7 @@ func (s *SolidarityServiceServerImpl) CreateBooking(ctx context.Context, req *pr
}
distance := s.Handler.CalculateDistanceBetweenFeatures(passenger.Passenger_departure_address, passenger.Passenger_destination_address)
priceType := proto.PriceType_FREE
resp = &proto.CreateBookingResponse{}
resp.Booking = &proto.Booking{
Id: bookingRequest.ID,
Driver: &proto.User{
@ -259,6 +260,7 @@ func (s *SolidarityServiceServerImpl) GetBooking(ctx context.Context, req *proto
if err != nil {
duration = 0
}
resp = &proto.GetBookingResponse{}
distance := s.Handler.CalculateDistanceBetweenFeatures(passenger.Passenger_departure_address, passenger.Passenger_destination_address)
priceType := proto.PriceType_FREE
resp.Booking = &proto.Booking{
@ -319,6 +321,7 @@ func (s *SolidarityServiceServerImpl) GetBookingsByStatus(ctx context.Context, r
if err != nil {
return nil, err
}
resp = &proto.GetBookingsByStatusResponse{}
responses := []*proto.Booking{}
for _, v := range bookings {
passenger, err := s.Handler.GetPassenger(context.Background(), v.Passenger.ID)
@ -401,6 +404,7 @@ func (s *SolidarityServiceServerImpl) DriverJourneys(ctx context.Context, req *p
if err != nil {
return nil, err
}
resp = &proto.DriverJourneysResponse{}
response := []*proto.DriverJourney{}
for _, v := range drivers {
temp := &proto.DriverJourney{}

View File

@ -518,7 +518,9 @@ func (s PostgresqlStorage) GetAllDrivers(date int64) (drivers []internal.Driver,
}
// Convert the date to the day of the week and make it lowercase.
dayOfWeek := strings.ToLower(time.Unix(date, 0).UTC().Format("Mon"))
fmt.Println(dayOfWeek)
for _, avail := range driver.RegularAvailabilities {
fmt.Println(strings.ToLower(avail.DayOfWeek))
if strings.ToLower(avail.DayOfWeek) == dayOfWeek {
drivers = append(drivers, driver)
break