mirror of
https://git.savannah.gnu.org/git/emacs/org-mode.git
synced 2024-11-23 07:18:53 +00:00
Allow to skip steps in clock reports that have zero time
* org-clock.el (org-dblock-write:clocktable): Return total time. (org-clocktable-steps): Skip step when time is zero and the :stepskip0 property is set. Rainer Stengele writes: > Creating clocktables for each day of a month is an excellent feature > in org! Problem for me is that many resulting tables have a total > time of 0:00. The problem is not really the zero time I spent but the > appearance of the tables with zero total time. > > Is there a possibility to skip getting such tables? Rational: I do > not need to show my boss or customer days where I spent 0:00 time on > the project. Now you can set :stepskip0 to achieve this.
This commit is contained in:
parent
7e2158651d
commit
5b68cf4c4f
@ -5607,6 +5607,7 @@ new table. The @samp{BEGIN} line can specify options:
|
||||
:tend @r{A time string specifying when to stop considering times.}
|
||||
:step @r{@code{week} or @code{day}, to split the table into chunks.}
|
||||
@r{To use this, @code{:block} or @code{:tstart}, @code{:tend} are needed.}
|
||||
:stepskip0 @r{Don't show steps that have zero time}
|
||||
:tags @r{A tags match to select entries that should contribute}
|
||||
:link @r{Link the item headlines in the table to their origins.}
|
||||
:formula @r{Content of a @code{#+TBLFM} line to be added and evaluated.}
|
||||
|
@ -1948,7 +1948,8 @@ the currently selected interval size."
|
||||
(org-table-recalculate 'all))
|
||||
(when rm-file-column
|
||||
(forward-char 1)
|
||||
(org-table-delete-column)))))))
|
||||
(org-table-delete-column))
|
||||
total-time)))))
|
||||
|
||||
(defun org-clocktable-steps (params)
|
||||
(let* ((p1 (copy-sequence params))
|
||||
@ -1956,8 +1957,9 @@ the currently selected interval size."
|
||||
(te (plist-get p1 :tend))
|
||||
(step0 (plist-get p1 :step))
|
||||
(step (cdr (assoc step0 '((day . 86400) (week . 604800)))))
|
||||
(stepskip0 (plist-get p1 :stepskip0))
|
||||
(block (plist-get p1 :block))
|
||||
cc range-text)
|
||||
cc range-text step-time)
|
||||
(when block
|
||||
(setq cc (org-clock-special-range block nil t)
|
||||
ts (car cc) te (nth 1 cc) range-text (nth 2 cc)))
|
||||
@ -1978,8 +1980,14 @@ the currently selected interval size."
|
||||
(seconds-to-time (setq ts (+ ts step))))))
|
||||
(insert "\n" (if (eq step0 'day) "Daily report: " "Weekly report starting on: ")
|
||||
(plist-get p1 :tstart) "\n")
|
||||
(org-dblock-write:clocktable p1)
|
||||
(setq step-time (org-dblock-write:clocktable p1))
|
||||
(re-search-forward "#\\+END:")
|
||||
(when (and (equal step-time 0) stepskip0)
|
||||
;; Remove the empty table
|
||||
(delete-region (point-at-bol)
|
||||
(save-excursion
|
||||
(re-search-backward "^\\(Daily\\|Weekly\\) report" nil t)
|
||||
(point))))
|
||||
(end-of-line 0))))
|
||||
|
||||
(defun org-clocktable-add-file (file table)
|
||||
|
Loading…
Reference in New Issue
Block a user