forked from ksalzke/miscellaneous-omnifocus-plugins
-
Notifications
You must be signed in to change notification settings - Fork 0
/
completedTaskReport.omnijs
42 lines (37 loc) · 1.05 KB
/
completedTaskReport.omnijs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
/*{
"type": "action",
"targets": ["omnifocus"],
"author": "Kaitlin Salzke",
"identifier": "com.KaitlinSalzke.completedTaskReport",
"version": "1.0",
"description": "Generate report of tasks completed today",
"label": "Completed Task Report",
"shortLabel": "Completed Task Report"
}*/
var _ = (function() {
var action = new PlugIn.Action(function(selection, sender) {
var now = new Date();
var today = Calendar.current.startOfDay(now);
var tasksCompletedToday = new Array();
library.apply(function(item) {
if (item instanceof Project && item.task.hasChildren) {
item.task.apply(tsk => {
if (tsk.completed && !tsk.hasChildren) {
if (
Calendar.current.startOfDay(tsk.completionDate).getTime() ==
today.getTime()
) {
tasksCompletedToday.push(tsk.name);
}
}
});
}
});
console.log(tasksCompletedToday.join("\n"));
});
action.validate = function(selection, sender) {
return true;
};
return action;
})();
_;