jtpio / trello-full-backup

Python script to backup everything from Trello: boards, lists, cards and attachments
MIT License
122 stars 36 forks source link

Missing card backups #38

Open mjf-ans opened 2 years ago

mjf-ans commented 2 years ago

There are many cards which are present in the board's $NAME_full.json backup, but don't get their own card.json file, and their attachments aren't downloaded.

The problem is here:

    cs = itertools.groupby(board_details['cards'], key=lambda x: x['idList'])
    for list_id, cards in cs:
        lists[list_id] = sorted(list(cards), key=lambda card: card['pos'])

This assumes that all the cards for any list are together in one batch in the board's data. If they are split up (which I've seen happen), the last batch in the itertools.groupby overwrites any previous ones in list, and only those cards are backed up.

This pull request fixes that.