openSUSE / trollolo

Trello command line client
GNU General Public License v3.0
41 stars 29 forks source link

`cleanup-sprint` fails due to incorrect board setup #201

Closed agraul closed 6 years ago

agraul commented 6 years ago

I came across this issue when I made the burndown generation part of cleanup-sprint optional.

The cli uses the provided --board-id and --target-board-id to setup the boards in this way:

boards = Scrum::Boards.new(@@settings.scrum)
s = Scrum::SprintCleaner.new(@@setting)
s.setup_boards(
  planning_board: boards.planning_board(board_from_id(options['board-id'])),
  target_board: board_from_id(options['target-board-id'])
 )

But the SprintCleaner tries to load the boards in a different way:

def load
  @board = @boards.sprint_board

  @target_board = @boards.target_board
  raise [...] unless target_list
end

def target_list
  @target_list ||= @target_board.lists.find { |l| l.name == @settings.scrum.list_names['planning_ready'] }
end

To fix this, planning_board: should be changed to sprint_board: boards.sprint_board(...).

What made it hard for me to figure this out at first was that we don't test the trollolo cleanup-sprint command yet and that the documentation does not explain which board-id is which (sprint/planning) - leaving me wondering if I gave the board ids correctly (the error was just that specific lists could not be found on the given boards.)

agraul commented 6 years ago

Since I already have this working locally, I'll rebase on top off #199 and add tests.