ForumsGetting Things Done®Finding Folders (Projects) with no Next Actions using Ruby


Finding Folders (Projects) with no Next Actions using Ruby
Author Message
jzohrab

Posted: Apr 01, 2012
Score: -1 Reference
I'm working out my GTD system currently, and use Folders for Projects. I wanted a way to get a list of Projects without Next actions. I wanted to do this quickly without actually opening all of my projects, because a) I'm lazy, and b) my project list may eventually grow quite big, and it's overwhelming to look at everything.

Sidebar: re my choice of Folders for Projects, I've considered other methods, but this was the simplest thing I could see. I've looked into Proximo's system, but using Tasks as Projects with subtasks as Tasks wasn't working for me.

I do some programming and so was able to use the Ruby client (ref http://www.toodledo.com/forums/3/21/0/command-line-client-in-ruby-available.html) to provide me with a quick command-line tool to get the list I wanted. After you install the gem and do the configuration, the following script works:

========

# This script lists projects without next actions.

require 'rubygems'
require 'toodledo'
require 'yaml'

# Get configured settings from $HOME/.toodledo/user-config.yml
HOME = ENV["HOME"] || ENV["HOMEPATH"] || File::expand_path("~")
TOODLEDO_D = File::join(HOME, ".toodledo")
CONFIG_F = File::join(TOODLEDO_D, "user-config.yml")
config = YAML.load(IO::read(CONFIG_F))

# Given a full list of folders, and a list of tasks, returns the list
# of folders outside of those of the tasks. For example, if the folder list
# is [A, B, C], and the task list contains tasks in folders [A, C],
# remaining_folders would return [B].
def remaining_folders(folders, tasks)
remove_fids = tasks.map { |t| t.folder.server_id() }
ret = folders.dup
ret.delete_if { |f| remove_fids.include?(f.server_id()) }
ret.sort { |a, b| a.name.downcase <=> b.name.downcase }
end

# Lists folders that don't have a next action defined.
def list_folders_missing_next_actions(folders, all_tasks)
puts "\nFolders without next actions:"
nexts = all_tasks.select { |t| t.status == Toodledo::Status::NEXT_ACTION }
remaining_folders(folders, nexts).each do |f|
puts " #{f.name}"
end
end

Toodledo.set_config(config)
Toodledo::begin do |session|
puts "Getting data ..."
tasks = session.get_tasks( :notcomp => true )
puts "Got tasks"
folders = tasks.map { |t| t.folder }.uniq

list_folders_missing_next_actions(folders, tasks)
end

========

Prerequisites:
- Ruby
- the gem, installed and configured on your machine with your account info


The above prints out a list of folders with no next actions. This may work as a convenient starting point for some people.

I'm working on other scripts and ideas for GTD using Toodledo, and hope to have my system worked out in the next month or so, at which point I'll post other scripts.

Thanks, good luck.

jz

(ps - Yeah, yeah, simple is best, I'm wasting my time overcomplicating things etc etc ... I'm working on it.)
You cannot reply yet

U Back to topic home

R Post a reply

To participate in these forums, you must be signed in.