emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* [PATCH] Support for more flexible effort specifications in TaskJuggler exporter
@ 2011-06-02  6:57 Stuart Hickinbottom
  2011-06-08 15:27 ` Christian Egli
  0 siblings, 1 reply; 2+ messages in thread
From: Stuart Hickinbottom @ 2011-06-02  6:57 UTC (permalink / raw)
  To: Org Mode

[-- Attachment #1: Type: text/plain, Size: 1485 bytes --]

Firstly thanks to Carsten and the whole community for org-mode - it's
really made a positive impact on my project organisation, project
tracking and record keeping at work.

I've been experimenting with tracking medium-sized tasks in org as a
work-breakdown and exporting to TaskJuggler to see just how many
evenings and weekends I'll have to work to meet my promised deadlines! A
recent patch (patch 638, 6th Match 2011) added support for more flexible
effort estimate properties such as 4h, 3.5d etc.

Unfortunately, at the moment the TaskJuggler exporter is more fussy over
this property and only accepts HH:MM or an integer, both of which it
translates to a number of days when exporting.

The attached patch adds support for passing-through effort
specifications when they're in the form "REAL UNIT" as they are for TJ,
supporting the suffixes d, w, m and y in a consistent way to org.
Support for HH:MM or bare number of days should still work as before. It
also cleans up another couple of things about the export of effort:

- HH:MM produces a floating point days duration now (was previously
rounded to an integer)
- The bare REAL effort regex failed to escape the decimal point (and
would match any char)
- Regexes now anchor to the string start to avoid matching the end of
duff values
- Docstring updated for more flexible effort specification

Apologies for my pidgin Emacs and elisp/regexes - this is my first
org-mode patch. Hopefully I've done it right...


[-- Attachment #2: taskjuggler-effort.patch --]
[-- Type: text/plain, Size: 1592 bytes --]

diff --git a/lisp/org-taskjuggler.el b/lisp/org-taskjuggler.el
index d2e5c1f..8f9174e 100644
--- a/lisp/org-taskjuggler.el
+++ b/lisp/org-taskjuggler.el
@@ -615,17 +615,19 @@ is defined it will calculate a unique id for the resource using
   "Translate effort strings into a format acceptable to taskjuggler,
 i.e. REAL UNIT. If the effort string is something like 5:30 it
 will be assumed to be hours and will be translated into 5.5h.
-Otherwise if it contains something like 3.0 it is assumed to be
-days and will be translated into 3.0d. Other formats that
-taskjuggler supports (like weeks, months and years) are currently
-not supported."
+TaskJuggler-compatible units are also supported for hours (h),
+days (d), weeks (w), months (m) and years (y) and so effort can
+be specified like 3h or 4.5d.  Otherwise if it contains a bare
+effort without a unit such as 3.0 it is assumed to be days and
+will be translated into 3.0d."
    ((null effort) effort)
    ((string-match "\\([0-9]+\\):\\([0-9]+\\)" effort)
     (let ((hours (string-to-number (match-string 1 effort)))
 	  (minutes (string-to-number (match-string 2 effort))))
-      (format "%dh" (+ hours (/ minutes 60.0)))))
-   ((string-match "\\([0-9]+\\).\\([0-9]+\\)" effort) (concat effort "d"))
+      (format "%.1fh" (+ hours (/ minutes 60.0)))))
+   ((string-match "^\\([0-9]+\\)\\(\\.\\([0-9]+\\)\\)?\\([hdwmy]\\)$" effort) effort)
+   ((string-match "^\\([0-9]+\\)\\.\\([0-9]+\\)$" effort) (concat effort "d"))
    (t (error "Not a valid effort (%s)" effort))))
 (defun org-taskjuggler-get-priority (priority)

^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2011-06-08 15:28 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-06-02  6:57 [PATCH] Support for more flexible effort specifications in TaskJuggler exporter Stuart Hickinbottom
2011-06-08 15:27 ` Christian Egli

Code repositories for project(s) associated with this public inbox


This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).