emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Bastien Guerry <bzg@altern.org>
To: emacs-orgmode@gnu.org
Subject: [Accepted] [O, 2/5] Mark a task as a milestone if it is a leaf node and cannot be scheduled
Date: Thu, 17 Mar 2011 09:45:36 +0100 (CET)	[thread overview]
Message-ID: <20110317084536.301FF6523@myhost.localdomain> (raw)
In-Reply-To: 1300273502-12977-3-git-send-email-christian.egli@alumni.ethz.ch

Patch 695 (http://patchwork.newartisans.com/patch/695/) is now "Accepted".

Maintainer comment: none

This relates to the following submission:

http://mid.gmane.org/%3C1300273502-12977-3-git-send-email-christian.egli%40alumni.ethz.ch%3E

Here is the original message containing the patch:

> Content-Type: text/plain; charset="utf-8"
> MIME-Version: 1.0
> Content-Transfer-Encoding: 7bit
> Subject: [O, 2/5] Mark a task as a milestone if it is a leaf node and cannot be
> 	scheduled
> Date: Wed, 16 Mar 2011 16:04:59 -0000
> From: Christian Egli <christian.egli@alumni.ethz.ch>
> X-Patchwork-Id: 695
> Message-Id: <1300273502-12977-3-git-send-email-christian.egli@alumni.ethz.ch>
> To: emacs-orgmode@gnu.org
> 
> * org-taskjuggler.el (org-taskjuggler-compute-task-leafiness): Compute
> the leafiness of a node.
> (org-taskjuggler-open-task, org-export-as-taskjuggler): Mark a node as
> a milestone if it is a leaf and has no effort.
> 
> Mark a task as a milestone if it has neither an effort, a duration, an
> end or a period. This is needed for tj3 export as tj3 fails to compile
> the file if there is a leaf node with no computable end date. tj2
> happily ignored the situation, but TJ3 throws an error.
> 
> ---
> lisp/org-taskjuggler.el |   37 +++++++++++++++++++++++++++++++------
>  1 files changed, 31 insertions(+), 6 deletions(-)
> 
> diff --git a/lisp/org-taskjuggler.el b/lisp/org-taskjuggler.el
> index ec6bb30..2d16790 100644
> --- a/lisp/org-taskjuggler.el
> +++ b/lisp/org-taskjuggler.el
> @@ -263,9 +263,10 @@ defined in `org-export-taskjuggler-default-reports'."
>    (let* ((tasks
>  	  (org-taskjuggler-resolve-dependencies
>  	   (org-taskjuggler-assign-task-ids 
> -	    (org-map-entries 
> -	     '(org-taskjuggler-components) 
> -	     org-export-taskjuggler-project-tag nil 'archive 'comment))))
> +	    (org-taskjuggler-compute-task-leafiness
> +	     (org-map-entries 
> +	      '(org-taskjuggler-components) 
> +	      org-export-taskjuggler-project-tag nil 'archive 'comment)))))
>  	 (resources
>  	  (org-taskjuggler-assign-resource-ids
>  	   (org-map-entries 
> @@ -392,6 +393,23 @@ a path to the current task."
>  	(setq previous-level level)
>  	(setq resolved-tasks (append resolved-tasks (list task)))))))
>  
> +(defun org-taskjuggler-compute-task-leafiness (tasks)
> +  "Figure out if each task is a leaf by looking at it's level,
> +and the level of its successor. If the successor is higher (ie
> +deeper), then it's not a leaf."
> +  (cond
> +   ((null tasks) nil)
> +   ;; if a task has no successors it is a leaf
> +   ((null (car (cdr tasks)))
> +    (cons (cons (cons "leaf-node" t) (car tasks)) 
> +	  (org-taskjuggler-compute-task-leafiness (cdr tasks))))
> +   ;; if the successor has a lower level than task it is a leaf
> +   ((<= (cdr (assoc "level" (car (cdr tasks)))) (cdr (assoc "level" (car tasks)))) 
> +    (cons (cons (cons "leaf-node" t) (car tasks)) 
> +	  (org-taskjuggler-compute-task-leafiness (cdr tasks))))
> +   ;; otherwise examine the rest of the tasks
> +   (t (cons (car tasks) (org-taskjuggler-compute-task-leafiness (cdr tasks))))))
> +
>  (defun org-taskjuggler-assign-resource-ids (resources &optional unique-ids)
>    "Given a list of resources return the same list, assigning a
>  unique id to each resource."
> @@ -621,11 +639,17 @@ org-mode priority string."
>  		      (cdr (assoc "complete" task))))
>  	(parent-ordered (cdr (assoc "parent-ordered" task)))
>  	(previous-sibling (cdr (assoc "previous-sibling" task)))
> +	(milestone (or (cdr (assoc "milestone" task))
> +		       (and (assoc "leaf-node" task)
> +			    (not (or effort 
> +				     (cdr (assoc "duration" task))
> +				     (cdr (assoc "end" task))
> +				     (cdr (assoc "period" task)))))))
>  	(attributes 
>  	 '(account start note duration endbuffer endcredit end
> -	   flags journalentry length maxend maxstart milestone
> -	   minend minstart period reference responsible
> -	   scheduling startbuffer startcredit statusnote)))
> +	   flags journalentry length maxend maxstart minend
> +	   minstart period reference responsible scheduling
> +	   startbuffer startcredit statusnote)))
>      (insert
>       (concat 
>        "task " unique-id " \"" headline "\" {\n" 
> @@ -639,6 +663,7 @@ org-mode priority string."
>        (and complete (format " complete %s\n" complete))
>        (and effort (format " effort %s\n" effort))
>        (and priority (format " priority %s\n" priority))
> +      (and milestone (format " milestone\n"))
>        
>        (org-taskjuggler-get-attributes task attributes)
>        "\n"))))
> 

  reply	other threads:[~2011-03-17 10:36 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-03-16 11:04 [PATCH 0/5] Improvements to Taskjuggler export Christian Egli
2011-03-16 11:04 ` [PATCH 1/5] Add some minimal infrastructure to handle export to both tj2 and tj3 Christian Egli
2011-03-17  8:44   ` [Accepted] [O, " Bastien Guerry
2011-03-17  8:59   ` [PATCH " Bastien
2011-03-17 10:39     ` Christian Egli
2011-03-17 10:56       ` Bastien
2011-03-16 11:04 ` [PATCH 2/5] Mark a task as a milestone if it is a leaf node and cannot be scheduled Christian Egli
2011-03-17  8:45   ` Bastien Guerry [this message]
2011-03-16 11:05 ` [PATCH 3/5] Replace recursive functions with iterative ones Christian Egli
2011-03-16 11:05 ` [PATCH 4/5] Remove a spurious debug statement Christian Egli
2011-03-16 11:05 ` [PATCH 5/5] Escape double quotes in headlines Christian Egli
2011-03-17  8:49   ` [Accepted] [O,5/5] " Bastien Guerry
2011-03-16 20:33 ` [PATCH 0/5] Improvements to Taskjuggler export Marc-Oliver Ihm
2011-03-17  8:57   ` Bastien
2011-03-17 20:47     ` Christian Egli
2011-03-17 20:46   ` Christian Egli
2011-03-17  8:56 ` Bastien
2011-03-17 10:42   ` Christian Egli
2011-03-17 10:58     ` Bastien
2011-03-18  7:54   ` Christian Egli

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20110317084536.301FF6523@myhost.localdomain \
    --to=bzg@altern.org \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

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