[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[emacs-wiki-discuss] Timeclock reports Re: planner-mode for contractors
From: |
Sacha Chua |
Subject: |
[emacs-wiki-discuss] Timeclock reports Re: planner-mode for contractors (multi-layered planners?) |
Date: |
Thu, 09 Jun 2005 16:46:45 +0800 |
User-agent: |
Gnus/5.11 (Gnus v5.11) Emacs/21.3.50 (gnu/linux) |
Hiya, everyone!
micah milano <address@hidden> writes:
> 2005.06.02 | Task I finished today (Completed) | 1:20
> 2005.06.02 | Task I did some work on today (Pending) | 2:45
> 2005.06.01 | Task I did work on yesterday (Pending) | 4:10
> 2005.05.31 | Task I did work on two days ago (Completed) | 0:30
> 2005.05.15 | Task I did work on two weeks ago (Pending) | 2:15
Progress! After much struggling with timeclock (that thing could
really use more documentation), I can use
(insert (planner-timeclock-summary-format-list
(planner-timeclock-summary-get-day-list "2005.06.09" "planner")))
to generate reports like
2005.06.09 | Make a breakdown for planner-timeclock-summary : E-Mail from micah
milano | 1:03
2005.06.09 | Re-fix gnus-registry 5.9.0 issue : E-Mail from Patricia J. Hawkins
| 0:02
2005.06.09 | Merge dryice/42 for planner-authz : E-Mail from Dryice Dong Liu |
0:46
Total: 1:52
and
(insert (planner-timeclock-summary-format-list
(planner-timeclock-summary-get-day-list "2005.06.09")))
to generate reports like
2005.06.09 | Make a breakdown for planner-timeclock-summary : E-Mail from micah
milano | 1:04
2005.06.09 | Re-fix gnus-registry 5.9.0 issue : E-Mail from Patricia J. Hawkins
| 0:02
2005.06.09 | Merge dryice/42 for planner-authz : E-Mail from Dryice Dong Liu |
0:46
2005.06.09 | Finish contact information and work history for nonimmigrant visa
applicant | 0:19
2005.06.09 | Finish supplemental nonimmigrant visa application form | 0:15
2005.06.09 | Check on DHL package | 0:01
2005.06.09 | 1h Finish US embassy form | 0:03
Total: 2:33
It's planner-multi friendly, too.
I haven't thought about how to include the completed/pending
information yet, but monkeying around with
planner-timeclock-summary-format-list should do the trick. Also, it
should be relatively easy to write a function that will let you run
this over a range of dates...
----------------------------------------------------------------
(defun planner-timeclock-entry-task (entry)
"Return the task associated with ENTRY."
(when (listp entry) (setq entry (timeclock-entry-project entry)))
(if (or (string-match
(concat "^\\(?:" emacs-wiki-name-regexp "\\): ")
entry)
(and (featurep 'planner-multi)
(string-match
(concat "^\\(?:" emacs-wiki-name-regexp "\\)"
"\\(?:" planner-multi-separator
"\\(?:" emacs-wiki-name-regexp "\\)\\)*: ")
entry))
(string-match "^: " entry))
(substring entry (match-end 0))
entry))
(defun planner-timeclock-entry-plan (entry)
"Return the plan page(s) associated with ENTRY."
(when (listp entry) (setq entry (timeclock-entry-project entry)))
(when (or (string-match
(concat "^\\(" emacs-wiki-name-regexp "\\): ")
entry)
(and (featurep 'planner-multi)
(string-match
(concat "^\\(\\(?:" emacs-wiki-name-regexp "\\)"
"\\(?:" planner-multi-separator
"\\(?:" emacs-wiki-name-regexp "\\)\\)*\\): ")
entry)))
(match-string 1 entry)))
(defun planner-timeclock-check-plan-p (plan task-plans)
"Return non-nil if PLAN is associated with TASK-PLANS."
(or (null plan)
(string= plan task-plans)
(and (featurep 'planner-multi)
(planner-multi-link-member plan
(planner-multi-split task-plans)))))
(defun planner-timeclock-summary-get-day-list (date &optional plan-query)
"Return the summary for DATE.
If PLAN-QUERY is a function, call it with the complete text of the task.
If PLAN-QUERY is a string, match it against the plans for the task.
Only tasks matching PLAN-QUERY will be returned, or all if PLAN-QUERY is nil."
(with-planner
(let (timeclock-entries
day-entries
lookup)
(setq timeclock-entries
(cdr (assoc
(emacs-wiki-replace-regexp-in-string "\\." "/" date)
(timeclock-day-alist))))
(while timeclock-entries
(when (timeclock-entry-project (car timeclock-entries))
(let ((task (planner-timeclock-entry-task (car timeclock-entries)))
(length (timeclock-entry-length (car timeclock-entries))))
(when
(if (functionp plan-query)
(funcall plan-query (timeclock-entry-project
(car timeclock-entries)))
(planner-timeclock-check-plan-p
plan-query
(planner-timeclock-entry-plan (car timeclock-entries))))
(setq lookup (assoc task day-entries))
(if lookup
(setcdr (cdr lookup)
(cons (+ length (elt lookup 2)) nil))
(add-to-list 'day-entries (list task date length))))))
(setq timeclock-entries (cdr timeclock-entries)))
day-entries)))
(defun planner-timeclock-summary-format-list (list)
"Format LIST as a list of timeclock entries."
(let ((total 0))
(concat
(mapconcat
(lambda (entry)
(setq total (+ total (elt entry 2)))
(concat (elt entry 1) " | " ; date
(elt entry 0) " | " ; task
(timeclock-seconds-to-string (elt entry 2)) "\n"))
list
"")
"\nTotal: " (timeclock-seconds-to-string total) "\n")))
--
Sacha Chua <address@hidden> - open source geekette
http://sacha.free.net.ph/ - PGP Key ID: 0xE7FDF77C
interests: emacs, gnu/linux, personal information management, CS ed
sachac on irc.freenode.net#emacs . YM: sachachua83
Re: [emacs-wiki-discuss] planner-mode for contractors (multi-layered planners?), Dryice Liu, 2005/06/01
Re: [emacs-wiki-discuss] planner-mode for contractors (multi-layered planners?), Chris Parsons, 2005/06/02