lib/scrum_board.rb in trollolo-0.0.9 vs lib/scrum_board.rb in trollolo-0.0.10

- old
+ new

@@ -1,8 +1,9 @@ class ScrumBoard class DoneColumnNotFoundError < StandardError; end + class AcceptedColumnNotFoundError < StandardError; end def initialize(board_data, settings) @settings = settings @board_data = board_data end @@ -20,12 +21,21 @@ done_columns.max_by{|c| c.name.match(@settings.done_column_name_regex).captures.first.to_i } end end end + def accepted_column + accepted_columns = columns.select{|c| c.name =~ @settings.accepted_column_name_regex } + if accepted_columns.empty? + EmptyColumn.new + else + accepted_columns.max_by{|c| c.name.match(@settings.accepted_column_name_regex).captures.first.to_i } + end + end + def done_cards - done_column.committed_cards + done_column.committed_cards + accepted_column.committed_cards end def open_columns columns.select{ |col| @settings.not_done_columns.include?(col.name) } end @@ -54,15 +64,15 @@ committed_cards.map(&:tasks).sum end def extra_cards - (done_column.extra_cards + open_columns.map(&:extra_cards)).flatten(1) + (done_column.extra_cards + accepted_column.extra_cards + open_columns.map(&:extra_cards)).flatten(1) end def extra_done_cards - done_column.extra_cards + done_column.extra_cards + accepted_column.extra_cards end def extra_done_story_points extra_done_cards.map(&:story_points).sum end @@ -83,15 +93,15 @@ extra_cards.map(&:done_tasks).sum end def unplanned_cards - (done_column.unplanned_cards + open_columns.map(&:unplanned_cards)).flatten(1) + (done_column.unplanned_cards + accepted_column.unplanned_cards + open_columns.map(&:unplanned_cards)).flatten(1) end def unplanned_done_cards - done_column.unplanned_cards + done_column.unplanned_cards + accepted_column.unplanned_cards end def unplanned_done_story_points unplanned_done_cards.map(&:story_points).sum end @@ -116,14 +126,14 @@ def open_fast_lane_cards_count open_columns.map(&:fast_lane_cards).flatten(1).count end def done_fast_lane_cards_count - done_column.fast_lane_cards.count + done_column.fast_lane_cards.count + accepted_column.fast_lane_cards.count end def scrum_cards - open_columns.map(&:fast_lane_cards).flatten(1) + done_column.cards + open_columns.map(&:fast_lane_cards).flatten(1) + done_column.cards + accepted_column.cards end def meta_cards scrum_cards.select{|c| c.meta_card? } end