2

I use org-mode agendas to sum effort for a given day, so I know how much slack time I have in my schedule. However, I often have sub-trees in tasks that have been assigned to assistants (with the keyword "ASSIGNED"). I don't want to count the effort estimates for those tasks in my own effort estimates. However, I do want to keep the effort estimates for those tasks, since I generate separate reports for each of my assistants so I know how much work I've assigned to them.

I know it is possible to have column-view exclude archived tasks. However, archiving ASSIGNED tasks seems like a bad work-around! I also know how to exclude ASSIGNED tasks from my agenda. However, doing so does not affect the total time estimates I get using column-view on my agenda.

Is there a method of excluding tasks based on a tag or keyword from Effort estimates?

1

This is a somewhat clunky work-around that accomplishes the desired effect.

I used org-trigger-hook to have a switch of a keyword to ASSIGNED trigger a function that changes the property "Effort" to "ASSIGNED_EFFORT". For good measure, if the keyword gets switched from ASSIGNED to TODO, the opposite happens:

(defun jkh/org-effort-to-assigned (change-plist)
  (let* ((type (plist-get change-plist :type))
     (pos (plist-get change-plist :position))
 (from (plist-get change-plist :from))
 (to (plist-get change-plist :to))
 (org-log-done nil) ; IMPROTANT!: no logging during automatic trigger!
 trigger triggers tr p1 kwd)
  (when (equal to "ASSIGNED")
  ;; OK, we just switched to ASSIGNED state.
       ;; Lets see if this entry has an Effort property.
       (setq myeffort (org-entry-get pos "Effort"))
       (org-entry-put pos "ASSIGNED_EFFORT" myeffort)
       (org-entry-delete pos "Effort")
       )
  (when (and (equal from "ASSIGNED") (equal to "TODO"))
    (setq myeffort (org-entry-get pos "ASSIGNED_EFFORT"))
    (org-entry-put pos "Effort" myeffort)
    (org-entry-delete pos "ASSIGNED_EFFORT"))
  ))

(add-hook 'org-trigger-hook 'jkh/org-effort-to-assigned)

Now, any effort assigned to that task will not be included in any summary of "Effort", for the obvious reason.

However, I still want to see how much time I've assigned to a particular assistant. This requires three steps. First, I make sure that a switch to "ASSIGNED" also adds the tag "ASSIGNED", and switching from "ASSIGNED" to "TODO" removes it:

(setq org-todo-state-tags-triggers
   (quote (("ASSIGNED" ("ASSIGNED" . t))
           ("TODO" ("ASSIGNED")))))

I also add a tag to any assigned task saying who it was assigned to (e.g., "Smith").

Now, I have a custom agenda function that lets me look at things assigned to Smith:

(setq org-agenda-custom-commands
  (quote (("S" "Smith"
   ((tags-todo "pMu+ASSIGNED"
     ((org-agenda-overriding-header "Assigned: Smith")
      (org-tags-match-list-sublevels nil)))))

The last thing I need to do is adjust column-view defaults:

(setq org-columns-default-format "%60ITEM(Task) %6Effort(Estim){:} %8ASSIGNED_EFFORT(Assigned){:}  %6CLOCKSUM(Clock)")

Now, if I use column-view on an agenda, I see a sum of my effort and a sum of assigned effort. If I'm looking at the default agenda, assigned effort should be 0. If I'm looking at my "Smith" agenda, I should only see assigned effort, whereas my effort will be 0.

There are two problems with this solution, though:

  1. Column view always shows both Effort and ASSIGNED_EFFORT, even though only one will be relevant for any particular agends.

  2. If the task has sub-tasks, I need to ASSIGN every sub-task as well.

I am pretty sure that the solution to #2 lies somewhere in the methods used by this org-depend.el. However, I don't see a way around #1.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.