Last active
December 27, 2015 09:49
-
-
Save gatesphere/7306696 to your computer and use it in GitHub Desktop.
Using nodewatch.py for productivity
This file contains hidden or 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
import datetime | |
import operator | |
from dateutil.relativedelta import relativedelta # do a 'pip install python-dateutil' for this |
This file contains hidden or 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
@language python | |
<< imports >> | |
@others | |
categoryname = 'LTD: 04 Due This Month' | |
today = datetime.date.today() + relativedelta(months=1) | |
tasks = get_tasks_by_date(today, comparator=operator.le) | |
c.theNodewatchController.add(categoryname, tasks) |
This file contains hidden or 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
@language python | |
<< imports >> | |
@others | |
categoryname = 'LTD: 03 Due This Week' | |
today = datetime.date.today() + relativedelta(days=7) | |
tasks = get_tasks_by_date(today, comparator=operator.le) | |
c.theNodewatchController.add(categoryname, tasks) |
This file contains hidden or 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
@language python | |
<< imports >> | |
@others | |
categoryname = 'LTD: 01 Due Today' | |
today = datetime.date.today() | |
tasks = get_tasks_by_date(today, comparator=operator.eq) | |
c.theNodewatchController.add(categoryname, tasks) |
This file contains hidden or 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
@language python | |
<< imports >> | |
@others | |
categoryname = 'LTD: 02 Due Tomorrow' | |
today = datetime.date.today() + relativedelta(days=1) | |
tasks = get_tasks_by_date(today, comparator=operator.eq) | |
c.theNodewatchController.add(categoryname, tasks) |
This file contains hidden or 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
@language python | |
<< imports >> | |
@others | |
categoryname = 'LTD: 00 Past Due' | |
today = datetime.date.today() | |
tasks = get_tasks_by_date(today, comparator=operator.lt) | |
c.theNodewatchController.add(categoryname, tasks) |
This file contains hidden or 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
## workhorse | |
def get_tasks_by_date(date, comparator=operator.lt): | |
n = [] | |
for v in c.all_unique_nodes(): | |
duedate = c.cleo.getat(v, 'duedate') | |
nextworkdate = c.cleo.getat(v, 'nextworkdate') | |
priority = c.cleo.getat(v, 'priority') | |
if priority: priority = int(priority) | |
if (((duedate and comparator(duedate,date)) or | |
(nextworkdate and comparator(nextworkdate,date))) | |
and priority != 100): | |
n.append(v) | |
return n |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment