emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* [bug] how to specify the format for clock table summaries and bug in formula calculations
@ 2013-09-29 12:33 Eric S Fraga
  2013-09-29 13:21 ` Carsten Dominik
  2013-09-29 13:24 ` Daniele Pizzolli
  0 siblings, 2 replies; 5+ messages in thread
From: Eric S Fraga @ 2013-09-29 12:33 UTC (permalink / raw)
  To: emacs-orgmode

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

Hello,

I am clocking a number of tasks and need a summary.  The functionality
provided by the org-clock table is ideal for my use case.  

However, the total time summaries use numbers of days when the number of
hours exceeds 24.  Although this is fine most of the time, I would like
to have total hours instead.  Is this possible?

More importantly, the ":formula %" option does not work as soon as days
appear in the summaries!  The calculations for the percentages use only
the hours in the totals, regardless of the number of days leading to
some very interesting results (percentages > 100).  I don't know enough
emacs calc to start to suggest how this could be fixed
unfortunately... :(

ECM attached.

Any pointers appreciated! 

Thanks, 
eric

-- 
: Eric S Fraga (0xFFFCF67D), Emacs 24.3.50.1, Org release_8.2-20-gc5f370

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: clocking.org --]
[-- Type: text/x-org, Size: 1066 bytes --]

* clocking
** task A
CLOCK: [2013-09-21 Sat 12:00]--[2013-09-21 Sat 18:00] =>  6:00
CLOCK: [2013-09-19 Thu 14:49]--[2013-09-19 Thu 17:50] =>  3:01
CLOCK: [2013-09-19 Thu 08:49]--[2013-09-19 Thu 11:50] =>  3:01
** task B
CLOCK: [2013-09-20 Fri 08:49]--[2013-09-20 Fri 18:50] => 10:01
CLOCK: [2013-09-19 Thu 11:50]--[2013-09-19 Thu 14:40] =>  2:50
** task C
CLOCK: [2013-09-18 Wed 08:00]--[2013-09-18 Wed 14:50] =>  6:50
CLOCK: [2013-09-17 Tue 08:35]--[2013-09-17 Tue 18:50] => 10:15
CLOCK: [2013-09-16 Mon 08:45]--[2013-09-16 Mon 16:50] =>  8:05
** Summary
#+BEGIN: clocktable :maxlevel 2 :scope file :formula %
#+CAPTION: Clock summary at [2013-09-29 Sun 13:29]
| Headline   | Time    |         |     % |
|------------+---------+---------+-------|
| *Total time* | *2d 2:03* |         | 100.0 |
|------------+---------+---------+-------|
| clocking   | 2d 2:03 |         | 100.0 |
| \__ task A |         |   12:02 | 587.0 |
| \__ task B |         |   12:51 | 626.8 |
| \__ task C |         | 1d 1:10 |  56.9 |
#+TBLFM: $4='(org-clock-time% @2$2 $2..$3);%.1f
#+END:


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

* Re: [bug] how to specify the format for clock table summaries and bug in formula calculations
  2013-09-29 12:33 [bug] how to specify the format for clock table summaries and bug in formula calculations Eric S Fraga
@ 2013-09-29 13:21 ` Carsten Dominik
  2013-09-30 11:38   ` Eric S Fraga
  2013-09-29 13:24 ` Daniele Pizzolli
  1 sibling, 1 reply; 5+ messages in thread
From: Carsten Dominik @ 2013-09-29 13:21 UTC (permalink / raw)
  To: Eric S Fraga; +Cc: emacs-orgmode

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

Hi Eric,

this would be

(setq org-time-clocksum-format "%d:%02d")

For more information, take a look at the function
`org-minutes-to-clocksum-string' and the variables mentioned
in its docstring.

HTH

- Carsten


On 29.9.2013, at 14:33, Eric S Fraga <e.fraga@ucl.ac.uk> wrote:

> Hello,
> 
> I am clocking a number of tasks and need a summary.  The functionality
> provided by the org-clock table is ideal for my use case.  
> 
> However, the total time summaries use numbers of days when the number of
> hours exceeds 24.  Although this is fine most of the time, I would like
> to have total hours instead.  Is this possible?
> 
> More importantly, the ":formula %" option does not work as soon as days
> appear in the summaries!  The calculations for the percentages use only
> the hours in the totals, regardless of the number of days leading to
> some very interesting results (percentages > 100).  I don't know enough
> emacs calc to start to suggest how this could be fixed
> unfortunately... :(
> 
> ECM attached.
> 
> Any pointers appreciated! 
> 
> Thanks, 
> eric
> 
> -- 
> : Eric S Fraga (0xFFFCF67D), Emacs 24.3.50.1, Org release_8.2-20-gc5f370
> <clocking.org>


[-- Attachment #2: Message signed with OpenPGP using GPGMail --]
[-- Type: application/pgp-signature, Size: 455 bytes --]

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

* Re: [bug] how to specify the format for clock table summaries and bug in formula calculations
  2013-09-29 12:33 [bug] how to specify the format for clock table summaries and bug in formula calculations Eric S Fraga
  2013-09-29 13:21 ` Carsten Dominik
@ 2013-09-29 13:24 ` Daniele Pizzolli
  2013-09-30 11:38   ` Eric S Fraga
  1 sibling, 1 reply; 5+ messages in thread
From: Daniele Pizzolli @ 2013-09-29 13:24 UTC (permalink / raw)
  To: emacs-orgmode

On 09/29/2013 02:33 PM, Eric S Fraga wrote:
> Hello,

Hello Eric,

> I am clocking a number of tasks and need a summary.  The functionality
> provided by the org-clock table is ideal for my use case.
>
> However, the total time summaries use numbers of days when the number of
> hours exceeds 24.  Although this is fine most of the time, I would like
> to have total hours instead.  Is this possible?

I found this snippet in the past:

#+BEGIN_SRC elisp :results silent
(setq org-time-clocksum-format '(:hours "%d" :require-hours t :minutes ":%02d" :require-minutes t))
#+END_SRC

[]

> More importantly, the ":formula %" option does not work as soon as days
> appear in the summaries!

With the suggested format it seems to be correct:

#+BEGIN: clocktable :maxlevel 2 :scope file :formula %
#+CAPTION: Clock summary at [2013-09-29 Sun 15:22]
| Headline     | Time    |       |     % |
|--------------+---------+-------+-------|
| *Total time* | *50:03* |       | 100.0 |
|--------------+---------+-------+-------|
| clocking     | 50:03   |       | 100.0 |
| \__ task A   |         | 12:02 |  24.0 |
| \__ task B   |         | 12:51 |  25.7 |
| \__ task C   |         | 25:10 |  50.3 |
#+TBLFM: $4='(org-clock-time% @2$2 $2..$3);%.1f
#+END: clocktable

Regards,
Daniele

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

* Re: [bug] how to specify the format for clock table summaries and bug in formula calculations
  2013-09-29 13:21 ` Carsten Dominik
@ 2013-09-30 11:38   ` Eric S Fraga
  0 siblings, 0 replies; 5+ messages in thread
From: Eric S Fraga @ 2013-09-30 11:38 UTC (permalink / raw)
  To: Carsten Dominik; +Cc: emacs-orgmode

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

Carsten Dominik <carsten.dominik@gmail.com> writes:

> Hi Eric,
>
> this would be
>
> (setq org-time-clocksum-format "%d:%02d")

Thanks.  This does the job perfectly!  Is this documented somewhere?  I
did spend quite a bit of time looking in the manual and on Worg but to
no avail.

Given that the default doesn't work in general when using the percentage
formula, it might be a good idea to update the manual to at least point
to this variable?  Maybe something along the attached patch?

Thanks again,
eric

-- 
: Eric S Fraga (0xFFFCF67D), Emacs 24.3.50.1, Org release_8.1.1-7-gaecdf5

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Make-reference-to-formatting-variable-for-clock-tabl.patch --]
[-- Type: text/x-diff, Size: 1624 bytes --]

From 1218a2045656c563612d4d9f494dcbc4c3225509 Mon Sep 17 00:00:00 2001
From: Eric S Fraga <e.fraga@ucl.ac.uk>
Date: Mon, 30 Sep 2013 12:36:52 +0100
Subject: [PATCH] Make reference to formatting variable for clock table formula
 option

* doc/org.texi (The clock table): The formula percentage option may
not work properly with the default time summary formatting.  The
documentation refers the reader to the variable that may need to be
adjusted.
---
 doc/org.texi | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/doc/org.texi b/doc/org.texi
index bfbc43c..093750b 100644
--- a/doc/org.texi
+++ b/doc/org.texi
@@ -6536,9 +6536,11 @@ but you can specify your own function using the @code{:formatter} parameter.
              @r{property will get its own column.}
 :inherit-props @r{When this flag is @code{t}, the values for @code{:properties} will be inherited.}
 :formula     @r{Content of a @code{#+TBLFM} line to be added and evaluated.}
-             @r{As a special case, @samp{:formula %} adds a column with % time.}
              @r{If you do not specify a formula here, any existing formula}
              @r{below the clock table will survive updates and be evaluated.}
+             @r{As a special case, @samp{:formula %} adds a column with % time.}
+             @r{For this special case, it may be useful to change the default}
+             @r{formatting of time summaries: see @code{org-time-clocksum-format}}
 :formatter   @r{A function to format clock data and insert it into the buffer.}
 @end example
 To get a clock summary of the current level 1 tree, for the current
-- 
1.8.1.2


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

* Re: [bug] how to specify the format for clock table summaries and bug in formula calculations
  2013-09-29 13:24 ` Daniele Pizzolli
@ 2013-09-30 11:38   ` Eric S Fraga
  0 siblings, 0 replies; 5+ messages in thread
From: Eric S Fraga @ 2013-09-30 11:38 UTC (permalink / raw)
  To: Daniele Pizzolli; +Cc: emacs-orgmode

Daniele Pizzolli <dan@toel.it> writes:

[...]

> I found this snippet in the past:
>
> #+BEGIN_SRC elisp :results silent
> (setq org-time-clocksum-format '(:hours "%d" :require-hours t :minutes ":%02d" :require-minutes t))
> #+END_SRC

Thanks.  This is a longer version of Carsten's answer.  Very helpful!
-- 
: Eric S Fraga (0xFFFCF67D), Emacs 24.3.50.1, Org release_8.2.1-60-g31d1f2

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

end of thread, other threads:[~2013-09-30 11:39 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-09-29 12:33 [bug] how to specify the format for clock table summaries and bug in formula calculations Eric S Fraga
2013-09-29 13:21 ` Carsten Dominik
2013-09-30 11:38   ` Eric S Fraga
2013-09-29 13:24 ` Daniele Pizzolli
2013-09-30 11:38   ` Eric S Fraga

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