Last active
March 15, 2016 12:49
-
-
Save caiotarifa/a8f7e0a4629053d3f8a8 to your computer and use it in GitHub Desktop.
TimeTrello: Simple time tracking with Trello & Ruby.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'trello' | |
# Key & Token | |
TRELLO_DEVELOPER_PUBLIC_KEY = '' | |
TRELLO_MEMBER_TOKEN = '' | |
# General | |
BOARD_ID = '' | |
PREFIX = ':clock12: ' | |
# Helpers | |
def titlerize title | |
puts "\n" | |
puts '-' * 30 | |
puts '-> ' + title | |
puts '-' * 30 | |
end | |
# Auth | |
Trello.configure do |config| | |
config.developer_public_key = TRELLO_DEVELOPER_PUBLIC_KEY | |
config.member_token = TRELLO_MEMBER_TOKEN | |
end | |
# Select Board | |
board = Trello::Board.find(BOARD_ID) | |
# Get Comments | |
database = {} | |
current = '' | |
board.actions.each do |action| | |
next unless action.type == 'commentCard' | |
comment = action.data['text'] | |
next unless comment.start_with?(PREFIX) | |
card_name = action.card.name | |
member_name = Trello::Member.find(action.member_creator_id).username | |
if current != card_name | |
titlerize card_name | |
end | |
current = card_name | |
puts '- @' + member_name + ': ' + comment | |
end | |
# TODO: | |
# - Somar horas para o mesmo usuário. | |
# - Permitir configurar o intervalo para a busca e relatório. | |
# (Ex.: Últimos 30 dias ou desde o último dia 25.) | |
# - Armazenar informações de cards e membros para evitar consultas identicas. | |
# - Datas, aspas e hashtags como recursos adicionais. | |
# (Ex.: 🕛 10:00 [2016-03-10 03:05PM] "Página inicial finalizada." #FrontEnd #Design) | |
# (Obs.: Não obrigatório. Caso não tenha data assume a do comentário.) | |
# - O relatório deve ser calculado toda vez que o script rodar, para pegar as edições nos comentários. |
Author
caiotarifa
commented
Mar 15, 2016
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment