add filter in export fleets

This commit is contained in:
Nicolas CARON 2023-06-02 14:42:55 +02:00
parent ddb08cf671
commit b717be9b99
1 changed files with 9 additions and 15 deletions

View File

@ -5,12 +5,14 @@ import (
"fmt"
"net/http"
"git.coopgo.io/coopgo-apps/parcoursmob/utils/identification"
fleets "git.coopgo.io/coopgo-platform/fleets/grpcapi"
fleetsstorage "git.coopgo.io/coopgo-platform/fleets/storage"
groupsmanagement "git.coopgo.io/coopgo-platform/groups-management/grpcapi"
groupsstorage "git.coopgo.io/coopgo-platform/groups-management/storage"
accounts "git.coopgo.io/coopgo-platform/mobility-accounts/grpcapi"
accountsstorage "git.coopgo.io/coopgo-platform/mobility-accounts/storage"
"git.coopgo.io/coopgo-platform/groups-management/storage"
"github.com/xuri/excelize/v2"
)
@ -18,7 +20,6 @@ func (h *ExportsHandler) Bookings(w http.ResponseWriter, r *http.Request) {
vehicles := map[string]fleetsstorage.Vehicle{}
bookings := []fleetsstorage.Booking{}
reequest := &fleets.GetVehiclesRequest{
Namespaces: []string{"parcoursmob"},
}
@ -123,21 +124,14 @@ func (h *ExportsHandler) Bookings(w http.ResponseWriter, r *http.Request) {
}
}
}
fmt.Println("\n"+bookedbygroup+"\n")
// for _, a := range vehicle.Administrators {
// if a == bookedbygroup {
// fmt.Println("\n"+a+"\n")
// }
// }
// filter by group
g := r.Context().Value(identification.GroupKey)
group := g.(storage.Group)
// group := ""
// fmt.Printf("\n"+group+"\n")
// if bookedbygroup == group {
// continue
// }
if bookedbygroup != group.ID {
continue
}
beneficiary := beneficiaries_map[b.Driver]
adminunavailability := false