diff --git a/handlers/application/dashboard.go b/handlers/application/dashboard.go index 20aa99e..9a761a5 100644 --- a/handlers/application/dashboard.go +++ b/handlers/application/dashboard.go @@ -47,6 +47,7 @@ func (h *ApplicationHandler) Dashboard(w http.ResponseWriter, r *http.Request) { for _, account := range resp.Accounts[min:] { if filterAccount(r, account) { + fmt.Println(account) a := account.ToStorageType() accounts = append([]any{a}, accounts...) } diff --git a/handlers/exports/agenda.go b/handlers/exports/agenda.go index f6de827..15ec57e 100644 --- a/handlers/exports/agenda.go +++ b/handlers/exports/agenda.go @@ -84,7 +84,8 @@ func (h *ExportsHandler) Agenda(w http.ResponseWriter, r *http.Request) { f.SetCellValue("Sheet1", "F1", "Numéro allocataire / Pole emploi") f.SetCellValue("Sheet1", "G1", "Prescipteur") f.SetCellValue("Sheet1", "H1", "Prescipteur Nom") - f.SetCellValue("Sheet1", "I1", "Gestionnaire événement") + f.SetCellValue("Sheet1", "I1", "Prescipteur Email") + f.SetCellValue("Sheet1", "J1", "Gestionnaire événement") // f.SetCellValue("Sheet1", "I1", "Prescripteur téléphone") i := 2 @@ -94,24 +95,27 @@ func (h *ExportsHandler) Agenda(w http.ResponseWriter, r *http.Request) { } admin := groups[e.Owners[0]] - subscribedbygroup := "" - subscribedbyuser := "" - if v, ok := e.Data["subscribed_by"].(map[string]any); ok { - if v2, ok := v["group"].(map[string]any); ok { - if v3, ok := v2["id"].(string); ok { - subscribedbygroup = v3 - } - - } - if v4, ok := v["user"].(map[string]any); ok { - if v5, ok := v4["display_name"].(string); ok { - subscribedbyuser = v5 - } - - } - } - for _, s := range e.Subscriptions { + subscribedbygroup := "" + subscribedbyuser := "" + subscribedbyemail := "" + if v, ok := s.Data["subscribed_by"].(map[string]any); ok { + if v2, ok := v["group"].(map[string]any); ok { + if v3, ok := v2["name"].(string); ok { + subscribedbygroup = v3 + } + + } + if v4, ok := v["user"].(map[string]any); ok { + if v5, ok := v4["display_name"].(string); ok { + subscribedbyuser = v5 + } + if v6, ok := v4["email"].(string); ok { + subscribedbyemail = v6 + } + + } + } beneficiary := beneficiaries_map[s.Subscriber] @@ -121,9 +125,10 @@ func (h *ExportsHandler) Agenda(w http.ResponseWriter, r *http.Request) { f.SetCellValue("Sheet1", fmt.Sprintf("D%d", i), beneficiary.Data["last_name"]) f.SetCellValue("Sheet1", fmt.Sprintf("E%d", i), beneficiary.Data["first_name"]) f.SetCellValue("Sheet1", fmt.Sprintf("F%d", i), beneficiary.Data["file_number"]) - f.SetCellValue("Sheet1", fmt.Sprintf("G%d", i), groups[subscribedbygroup].Data["name"]) + f.SetCellValue("Sheet1", fmt.Sprintf("G%d", i), subscribedbygroup) f.SetCellValue("Sheet1", fmt.Sprintf("H%d", i), subscribedbyuser) - f.SetCellValue("Sheet1", fmt.Sprintf("I%d", i), admin.Data["name"]) + f.SetCellValue("Sheet1", fmt.Sprintf("I%d", i), subscribedbyemail) + f.SetCellValue("Sheet1", fmt.Sprintf("J%d", i), admin.Data["name"]) i = i + 1 }