-1

I have written function that returns array with all trello cards:

def get_cards_from_board(my_board_1):
    T = []
    lists = my_board_1.list_lists()
    for l in lists:
        cards = l.list_cards()
        for c in cards:
            assert isinstance(c, object)
            T.append(c)
    return T

But I want to return/print all trello cards that have been done, another words all trello cards from one list - . How can I do that ?

  • How can we tell that a "card" is "done"? –  Jul 16 '18 at 09:33
  • We replace it to "List Done" list. I need to return all trello cards from one "List Done" list but not from all lists in board. My script returns all cards from all lists and all boards. – Sergiy Baraban Jul 16 '18 at 09:38
  • Your code does not contain a "List Done". Is it an item in `lists`? Which? –  Jul 16 '18 at 09:39
  • is `List Done` some element of `lists`? How do we know if the current list is `List Done`, is some property attached to the list? – Ishan Srivastava Jul 16 '18 at 09:42
  • Please make your question more precise and to the point. There is too much intel missing in the question to which the answer you demand – Ishan Srivastava Jul 16 '18 at 09:43
  • Yes it is an item in lists. I have tried filtering "List Done" - list_lists("List Done" ) or list_cards("List Done" ) but it doesn't work. https://github.com/sarumont/py-trello/blob/master/trello/board.py – Sergiy Baraban Jul 16 '18 at 09:46

1 Answers1

1

I find the answer by myself:

def get_cards_from_board(my_board_1):
T = []
lists = my_board_1.list_lists()
for l in lists:
    if l.name == 'Done':
        cards = l.list_cards()
        for c in cards:
            assert isinstance(c, object)
            T.append(c)
return T