summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Arroyo Menéndez <davidam@es.gnu.org>2016-01-18 10:21:02 +0100
committerDavid Arroyo Menéndez <davidam@es.gnu.org>2016-01-18 10:21:02 +0100
commit5d78665c8cf8ebf9bb2738a3106a24476491c38a (patch)
tree0d67c26be63e0b8006f89f9c34e3cd8e7b1652d3
parenta20abaa725202e95faa06764ee026a2d9bcfe653 (diff)
downloadorg-mode-5d78665c8cf8ebf9bb2738a3106a24476491c38a.tar.gz
org-effectiveness.el: Add org-effectiveness-ntasks-in-date and org-effectiveness-plot-ascii-ntasks
* contrib/lisp/org-effectiveness.el (org-effectiveness-ntasks-in-date, org-effectiveness-plot-ascii-ntasks): Add functions.
-rw-r--r--contrib/lisp/org-effectiveness.el31
1 files changed, 31 insertions, 0 deletions
diff --git a/contrib/lisp/org-effectiveness.el b/contrib/lisp/org-effectiveness.el
index cbb9847..4dd4d94 100644
--- a/contrib/lisp/org-effectiveness.el
+++ b/contrib/lisp/org-effectiveness.el
@@ -116,6 +116,13 @@ many TODO pending"
(setq count (count-matches (concat "CANCEL+ED.*\n.*" date)))
(message "CANCELEDS: %d" count))
+(defun org-effectiveness-ntasks-in-date(date &optional notmessage)
+ (interactive "sGive me a date: " date)
+ (save-excursion
+ (goto-char (point-min))
+ (let ((tasks (float (count-matches (concat "^*.*\n.*" date)))))
+ (message "%d" tasks))))
+
(defun org-effectiveness-in-date(date &optional notmessage)
(interactive "sGive me a date: " date)
(save-excursion
@@ -273,6 +280,30 @@ many TODO pending"
(setq month (+ 1 month)))))
(switch-to-buffer "*org-effectiveness*"))
+
+(defun org-effectiveness-plot-ascii-ntasks (startdate enddate)
+ (interactive "sGive me the start date: \nsGive me the end date: " startdate enddate)
+ (setq dates (org-effectiveness-check-dates startdate enddate))
+ (let ((syear (cadr (assoc 'startyear dates)))
+ (smonth (cadr (assoc 'startmonth dates)))
+ (year (cadr (assoc 'startyear dates)))
+ (month (cadr (assoc 'startmonth dates)))
+ (emonth (cadr (assoc 'endmonth dates)))
+ (eyear (cadr (assoc 'endyear dates)))
+ (buffer (current-buffer))
+ (str ""))
+ (while (or (> eyear year) (and (= eyear year) (>= emonth month)))
+ (setq str (org-effectiveness-ntasks-in-date (concat (number-to-string year) "-" (org-effectiveness-month-to-string month)) 1))
+ (switch-to-buffer "*org-effectiveness*")
+ (org-effectiveness-ascii-bar (string-to-number str) (format "%s-%s" year month))
+ (switch-to-buffer buffer)
+ (if (eq month 12)
+ (progn
+ (setq year (+ 1 year))
+ (setq month 1))
+ (setq month (+ 1 month)))))
+ (switch-to-buffer "*org-effectiveness*"))
+
(defun org-effectiveness-plot-html (startdate enddate)
"Print html bars about the effectiveness in a buffer"
(interactive "sGive me the start date: \nsGive me the end date: " startdate enddate)