This commit is contained in:
kekskurse 2024-03-04 04:34:57 +01:00
parent b314b942b9
commit a52a9d67d1
2 changed files with 11 additions and 1 deletions

View file

@ -10,7 +10,7 @@ Add a Label with the text "Daily" and a colome with the Text "ToDo", it will mov
Remove cards from the "Done" list which are older than 7 days Remove cards from the "Done" list which are older than 7 days
## move-backlog-card-with-date ## move-backlog-card-with-date
Move all cards in the Backlog where the due date is in the past to the "ToDo" list and remove the due date Move all cards in the Backlog where the due date is in the past to the "ToDo" list and remove the due date. Move the cards with due date in the Back log list to the end of the list. Add a text comment.
## unassign-cards ## unassign-cards
Assign all card with have no assign user to the user how run the script Assign all card with have no assign user to the user how run the script

View file

@ -50,11 +50,21 @@ func moveBacklogCardWithDate(cCtx *cli.Context) error {
return fmt.Errorf("cant get card for Backlog list list: %w", err) return fmt.Errorf("cant get card for Backlog list list: %w", err)
} }
var cardsToMoveToTheEndOfTheList []*trello.Card
for _, card := range cards { for _, card := range cards {
log.Debug().Str("name", card.Name).Msg("Found card") log.Debug().Str("name", card.Name).Msg("Found card")
if card.Due == nil { if card.Due == nil {
for _, cardToMove := range cardsToMoveToTheEndOfTheList {
err = cardToMove.MoveToBottomOfList()
if err != nil {
return fmt.Errorf("cant move card to end: %w", err)
}
}
cardsToMoveToTheEndOfTheList = []*trello.Card{}
continue continue
} }
cardsToMoveToTheEndOfTheList = append(cardsToMoveToTheEndOfTheList, card)
if card.Due.Before(time.Now()) { if card.Due.Before(time.Now()) {
err = card.MoveToList(todoList.ID) err = card.MoveToList(todoList.ID)
if err != nil { if err != nil {