From 4fe479c1fb963a6b50a8fb519bd9fc1824ab2195 Mon Sep 17 00:00:00 2001 From: Nicolas Caron Date: Thu, 1 Jun 2023 10:59:21 +0200 Subject: [PATCH] edit exports/fleets --- handlers/exports/fleets.go | 29 +++++++++++++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-) diff --git a/handlers/exports/fleets.go b/handlers/exports/fleets.go index 381f4e2..d4ac2c0 100644 --- a/handlers/exports/fleets.go +++ b/handlers/exports/fleets.go @@ -45,6 +45,7 @@ func (h *ExportsHandler) Bookings(w http.ResponseWriter, r *http.Request) { } + groups := map[string]groupsstorage.Group{} admingroups, err := h.services.GRPC.GroupsManagement.GetGroups(context.TODO(), &groupsmanagement.GetGroupsRequest{ @@ -106,14 +107,38 @@ func (h *ExportsHandler) Bookings(w http.ResponseWriter, r *http.Request) { bookedby := "" if v, ok := b.Data["booked_by"].(map[string]any); ok { - if v2, ok := v["group"].(map[string]any); ok { - if v3, ok := v2["name"].(string); ok { + if v2, ok := v["user"].(map[string]any); ok { + if v3, ok := v2["display_name"].(string); ok { bookedby = v3 } } } + bookedbygroup := "" + if v4, ok := b.Data["booked_by"].(map[string]any); ok { + if v5, ok := v4["group"].(map[string]any); ok { + if v6, ok := v5["id"].(string); ok { + bookedbygroup = v6 + } + } + } + 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 + // } + beneficiary := beneficiaries_map[b.Driver] adminunavailability := false