From d655f1b42f6527201d71f8e6ecfe9eb2977a38b8 Mon Sep 17 00:00:00 2001 From: Elliott Stoneham Date: Sun, 11 Sep 2016 20:15:37 +0100 Subject: [PATCH] Pick up previous selection of boards checkboxes on edit --- core/section/trello/trello.go | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/core/section/trello/trello.go b/core/section/trello/trello.go index cfc374de..561b7c8e 100644 --- a/core/section/trello/trello.go +++ b/core/section/trello/trello.go @@ -288,6 +288,10 @@ func getBoards(config trelloConfig) (boards []trelloBoard, err error) { defer res.Body.Close() dec := json.NewDecoder(res.Body) err = dec.Decode(&b) + if err != nil { + fmt.Println(err) + return nil, err + } // we only show open, team boards (not personal) for _, b := range b { @@ -296,13 +300,15 @@ func getBoards(config trelloConfig) (boards []trelloBoard, err error) { } } - if err != nil { - fmt.Println(err) - return nil, err - } - - for bx := range boards { + for bx, bd := range boards { + for _, cd := range config.Boards { + if bd.ID == cd.ID { + boards[bx].Included = cd.Included // to pick up the previous selection or not + goto foundID + } + } boards[bx].Included = true // include boards by default + foundID: } return boards, nil