From b717be9b99ccd8867708c017b31b8307eb3f8c1d Mon Sep 17 00:00:00 2001 From: Nicolas Caron Date: Fri, 2 Jun 2023 14:42:55 +0200 Subject: [PATCH] add filter in export fleets --- handlers/exports/fleets.go | 24 +++++++++--------------- 1 file changed, 9 insertions(+), 15 deletions(-) diff --git a/handlers/exports/fleets.go b/handlers/exports/fleets.go index d4ac2c0..fb73fdc 100644 --- a/handlers/exports/fleets.go +++ b/handlers/exports/fleets.go @@ -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") - // } - // } - - // group := "" - - // fmt.Printf("\n"+group+"\n") - - // if bookedbygroup == group { - // continue - // } + // filter by group + g := r.Context().Value(identification.GroupKey) + group := g.(storage.Group) + + if bookedbygroup != group.ID { + continue + } beneficiary := beneficiaries_map[b.Driver] adminunavailability := false