Sha256: 99a75e7c811fa6ab9955aaa29daa3279813240f56f627a434c5c7a62adc74b55

Contents?: true

Size: 1.62 KB

Versions: 2

Compression:

Stored size: 1.62 KB

Contents

#  Copyright (c) 2013-2015 SUSE LLC
#
#  This program is free software; you can redistribute it and/or
#  modify it under the terms of version 3 of the GNU General Public License as
#  published by the Free Software Foundation.
#
#  This program is distributed in the hope that it will be useful,
#  but WITHOUT ANY WARRANTY; without even the implied warranty of
#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.   See the
#  GNU General Public License for more details.
#
#  You should have received a copy of the GNU General Public License
#  along with this program; if not, contact SUSE LLC.
#
#  To contact SUSE about this file by physical or electronic mail,
#  you may find current contact information at www.suse.com
class Column
  def initialize(board_data, list_id, settings = nil)
    @board_data = board_data
    @settings = settings
    @list_data = @board_data['lists'].find{|l| l['id'] == list_id}
  end

  def name
    @list_data['name']
  end

  def estimated_cards
    cards.select(&:estimated?)
  end

  def sum
    estimated_cards.map(&:story_points).sum
  end

  def tasks
    cards.map(&:tasks).sum
  end

  def done_tasks
    cards.map(&:done_tasks).sum
  end

  def extra_cards
    cards.select(&:extra?)
  end

  def unplanned_cards
    cards.select(&:unplanned?)
  end

  def committed_cards
    cards.select{|c| !c.extra? && !c.unplanned? && !c.swimlane?}
  end

  def fast_lane_cards
    cards.select(&:fast_lane?)
  end

  def cards
    return @cards if @cards

    cards = @board_data['cards'].select{|c| c['idList'] == @list_data['id']}
    @cards = cards.map{|c| Card.new(@board_data, c['id'], @settings)}
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
trollolo-0.3.1 lib/column.rb
trollolo-0.3.0 lib/column.rb