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.
This commit is contained in:
David Arroyo Menéndez 2016-01-18 10:21:02 +01:00
parent a20abaa725
commit 5d78665c8c
1 changed files with 31 additions and 0 deletions

View File

@ -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)