improvements
Some checks failed
Build and Push Docker Image / build_and_push (push) Failing after 34s
Some checks failed
Build and Push Docker Image / build_and_push (push) Failing after 34s
This commit is contained in:
@@ -39,7 +39,11 @@ func (h Handler) BookDriverJourney(passengerid string, driverid string, journeyi
|
||||
return &booking, nil
|
||||
}
|
||||
|
||||
func (h Handler) GetBookings(startdate time.Time, enddate time.Time, passengerid string) ([]*types.Booking, error) {
|
||||
func (h Handler) GetBookings(startdate time.Time, enddate time.Time, passengerid string, driverid string) ([]*types.Booking, error) {
|
||||
if enddate.Before(time.Date(2000, 1, 1, 0, 0, 0, 0, time.UTC)) {
|
||||
enddate = time.Date(9999, 12, 31, 0, 0, 0, 0, time.UTC)
|
||||
}
|
||||
log.Debug().Time("startdate", startdate).Time("enddate", enddate).Str("passengerid", passengerid).Str("driverid", driverid).Msg("GetBookings")
|
||||
res := []*types.Booking{}
|
||||
|
||||
bookings, err := h.Storage.GetAllBookings()
|
||||
@@ -50,7 +54,7 @@ func (h Handler) GetBookings(startdate time.Time, enddate time.Time, passengerid
|
||||
|
||||
for _, b := range bookings {
|
||||
if b.Journey.DriverDepartureDate.After(startdate) && b.Journey.DriverDepartureDate.Before(enddate) {
|
||||
if passengerid == "" || b.PassengerId == passengerid {
|
||||
if (passengerid == "" || b.PassengerId == passengerid) && (driverid == "" || b.DriverId == driverid) {
|
||||
res = append(res, b)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user