<commit_before>require 'trello'
require 'helpers/trello_helper'

Trello.configure do |config|
  config.developer_public_key = ENV['TRELLO_DEV_KEY']
  config.member_token = ENV['TRELLO_MEMBER_KEY']
end

class TrelloBoard

  include TrelloHelper

  def initialize(board_id)
    @board = trello_rescue{Trello::Board.find(board_id)}
    @cards = trello_rescue{@board.cards}
    @discuss_list = discuss_list
    @done_list = done_list
  end

  def outstanding
    cards = []
      if card.closed == false && trello_rescue{card.list}.id != @discuss_list && trello_rescue{card.list}.id != @done_list
        cards << get_progress(card)
      end
    end
    cards
  end

  def to_discuss
    cards = []
      if card.list.id == @discuss_list
    @cards.each do |card|
        cards << get_progress(card)
      end
    end
    cards
  end

  def done
    cards = []
      if trello_rescue{card.list}.id == @done_list
    @cards.each do |card|
        cards << get_progress(card)
      end
    end
    cards
  end

  def discuss_list
    get_list("to discuss")
  end

  def done_list
    get_list("done")
  end

  def get_list(name)
    trello_rescue{@board.lists}.select { |l| l.name.downcase == name.downcase }.first.id rescue nil
  end

  def get_progress(card)<commit_msg>Get list_id rather than going round the houses each time<commit_after>require 'trello'
require 'helpers/trello_helper'

Trello.configure do |config|
  config.developer_public_key = ENV['TRELLO_DEV_KEY']
  config.member_token = ENV['TRELLO_MEMBER_KEY']
end

class TrelloBoard

  include TrelloHelper

  def initialize(board_id)
    @board = trello_rescue{Trello::Board.find(board_id)}
    @cards = trello_rescue{@board.cards}
    @discuss_list = discuss_list
    @done_list = done_list
  end

  def outstanding
    cards = []
    @cards.each do |card|
      if card.closed == false && card.list_id != @discuss_list && card.list_id != @done_list
        cards << get_progress(card)
      end
    end
    cards
  end

  def to_discuss
    cards = []
    @cards.each do |card|
      if card.list_id == @discuss_list
        cards << get_progress(card)
      end
    end
    cards
  end

  def done
    cards = []
    @cards.each do |card|
      if card.list_id == @done_list
        cards << get_progress(card)
      end
    end
    cards
  end

  def discuss_list
    get_list("to discuss")
  end

  def done_list
    get_list("done")
  end

  def get_list(name)
    trello_rescue{@board.lists}.select { |l| l.name.downcase == name.downcase }.first.id rescue nil
  end

  def get_progress(card)
{'fraction_non_alphanumeric': 0.10242376856919469, 'fraction_numerical': 0.0, 'mean_word_length': 2.9128440366972477, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '90204', 'n_tokens_mistral': 931, 'n_tokens_neox': 890, 'n_words': 199}