add visualization off history page

This commit is contained in:
Nicolas CARON 2023-02-15 10:12:58 +01:00
parent 10bde53c5e
commit ab8cbf6f73
1 changed files with 10 additions and 7 deletions

View File

@ -432,14 +432,12 @@ func (h *ApplicationHandler) AgendaDeleteSubscribeEvent(w http.ResponseWriter, r
//////////////////////////////////////////////////////// ////////////////////////////////////////////////////////
// /////////////////////History Event////////////////////////
///////////////////////History Event////////////////////////
func (h *ApplicationHandler) AgendaHistoryEvent(w http.ResponseWriter, r *http.Request) { func (h *ApplicationHandler) AgendaHistoryEvent(w http.ResponseWriter, r *http.Request) {
vars := mux.Vars(r) vars := mux.Vars(r)
eventid := vars["eventid"] eventId := vars["eventid"]
request := &agenda.GetEventRequest{ request := &agenda.GetEventRequest{
Id: eventid, Id: eventId,
} }
resp, err := h.services.GRPC.Agenda.GetEvent(context.TODO(), request) resp, err := h.services.GRPC.Agenda.GetEvent(context.TODO(), request)
@ -449,6 +447,9 @@ func (h *ApplicationHandler) AgendaHistoryEvent(w http.ResponseWriter, r *http.R
return return
} }
fmt.Printf("hechttttt %+v\n", resp.Event.ToStorageType())
grouprequest := &groupsmanagement.GetGroupRequest{ grouprequest := &groupsmanagement.GetGroupRequest{
Id: resp.Event.Owners[0], Id: resp.Event.Owners[0],
} }
@ -463,7 +464,7 @@ func (h *ApplicationHandler) AgendaHistoryEvent(w http.ResponseWriter, r *http.R
subscribers := map[string]any{} subscribers := map[string]any{}
accids := []string{} accids := []string{}
for _, v := range resp.Event.Subscriptions { for _, v := range resp.Event.DeletedSubscription {
accids = append(accids, v.Subscriber) accids = append(accids, v.Subscriber)
} }
@ -491,7 +492,7 @@ func (h *ApplicationHandler) AgendaHistoryEvent(w http.ResponseWriter, r *http.R
accountids := []string{} accountids := []string{}
for _, m := range group.Members { for _, m := range group.Members {
if !contains(resp.Event.Subscriptions, m) { if !contains(resp.Event.DeletedSubscription, m) {
accountids = append(accountids, m) accountids = append(accountids, m)
} }
} }
@ -511,8 +512,10 @@ func (h *ApplicationHandler) AgendaHistoryEvent(w http.ResponseWriter, r *http.R
} }
} }
h.Renderer.AgendaHistoryEvent(w, r, resp.Event.ToStorageType(), groupresp.Group.ToStorageType(), subscribers, accounts) h.Renderer.AgendaHistoryEvent(w, r, resp.Event.ToStorageType(), groupresp.Group.ToStorageType(), subscribers, accounts)
} }
///////////////////////////////////////////////////////// /////////////////////////////////////////////////////////
// func contains[V string](s []V, e V) bool { // func contains[V string](s []V, e V) bool {