lib/trello_helper.rb
# generate a list of SortableCard objects from a list of cards
generate a list of SortableCard objects from a list of cards
generate a list of SortableCard objects from a list of cards
def sortable_cards(list)
    sortable_cards = []
    needs_sorting = false
    last_card = nil
    list_cards(list).sort_by { |card| card.pos }.each do |card|
      card = sortable_card(card)
      if card.release
        if last_card
          if !cards_in_order(last_card, card) && !cards_equal(last_card, card)
            needs_sorting = true
          end
        end
        last_card = card
      end
      sortable_cards << card
    end
    needs_sorting ? sortable_cards : nil
  end
def sortable_cards ( list ) sortable_cards = [ ] needs_sorting = false last_card = nil list_cards ( list ) . sort_by { | card | card . pos } . each do | card | card = sortable_card ( card ) if card . release if last_card if ! cards_in_order ( last_card , card ) && ! cards_equal ( last_card , card ) needs_sorting = true end end last_card = card end sortable_cards << card end needs_sorting ? sortable_cards : nil end
generate a list of SortableCard objects from a list of cards
generate a list of SortableCard objects from a list of cards
list