emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Multiple notions for what's a day
@ 2012-12-31 10:25 Sebastien Vauban
  2013-01-05 17:23 ` Bastien
  0 siblings, 1 reply; 4+ messages in thread
From: Sebastien Vauban @ 2012-12-31 10:25 UTC (permalink / raw)
  To: emacs-orgmode-mXXj517/zsQ

Hello,

For 6 weeks now, since the commit a00a7b2 of Toby, things have changed when
generating clock tables. For example, instead of getting this (for some sample
files I have):

    | File  | Headline       |  Time |
    |-------+----------------+-------|
    |       | ALL Total time | 30:19 |
    |-------+----------------+-------|
    | A.org | File time      |  2:59 |
    |-------+----------------+-------|
    | B.org | File time      |  2:30 |
    |-------+----------------+-------|
    | C.org | File time      | 24:50 |

    (edited for the sake of simplicity)

we do have, as of today:

    | File  | Headline       | Time    |
    |-------+----------------+---------|
    |       | ALL Total time | 1d 6:19 |
    |-------+----------------+---------|
    | A.org | File time      | 2:59    |
    |-------+----------------+---------|
    | B.org | File time      | 2:30    |
    |-------+----------------+---------|
    | C.org | File time      | 1d 0:50 |

That is, the presentation *default* has changed: it now displays big amounts
of hours in days (of 24 hours).

I don't welcome the change of the default as such -- as that could impact
computations made on those figures; OK, that's not such a big deal --, but I
clearly like the ability to generate such formats, much more readable.

However, there is now a problem of interpretation for the value of "days";
until now, a day was valued as "8 hours"... see `org-effort-durations':

    ╭────
    │ Its value is (("h" . 60)
    │  ("d" . 480) --> 8 hours a day
    │  ("w" . 2400) --> 40 hours a week
    │  ("m" . 9600)
    │  ("y" . 96000))
    ╰────

In the current situation, you'd express days of 8 hours for the Effort
property, but be presented with days of 24 hours for clocking display. Weird,
no?

I guess that the clock tables should use the values defined in
`org-effort-durations' for their display. Or, at least, any other solution
where a day has the same value when used for clock estimates and for clock
reports...

Just wanted to show a problem, and start a discussion on what should be
done...

Best regards,
  Seb

-- 
Sebastien Vauban

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

* Re: Multiple notions for what's a day
  2012-12-31 10:25 Multiple notions for what's a day Sebastien Vauban
@ 2013-01-05 17:23 ` Bastien
  2013-01-07 20:44   ` Bastien
  0 siblings, 1 reply; 4+ messages in thread
From: Bastien @ 2013-01-05 17:23 UTC (permalink / raw)
  To: Sebastien Vauban; +Cc: public-emacs-orgmode-mXXj517/zsQ

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

Hi Sébastien,

"Sebastien Vauban"
<wxhgmqzgwmuf-geNee64TY+gS+FvcfC7Uqw@public.gmane.org> writes:

> For 6 weeks now, since the commit a00a7b2 of Toby, things have changed when
> generating clock tables. For example, instead of getting this (for some sample
> files I have):

Indeed, there is a problem here.

Please try the attached patch against master, together with

  (setq org-time-clocksum-use-effort-durations t)

(or ":effort-durations t" as a parameter in the clocktable.)

Thanks,


[-- Attachment #2: 0001-New-option-org-time-clocksum-use-effort-durations.patch --]
[-- Type: text/x-patch, Size: 8603 bytes --]

From 9c31d781e9e770a584a9fc04737d3fd352f6a40b Mon Sep 17 00:00:00 2001
From: Bastien Guerry <bzg@altern.org>
Date: Sat, 5 Jan 2013 18:21:55 +0100
Subject: [PATCH] New option `org-time-clocksum-use-effort-durations'
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

* org.el (org-time-clocksum-format): Add a version tag and add
to the 'org-clock group.
(org-time-clocksum-use-fractional): Ditto.
(org-time-clocksum-use-effort-durations): New option to allow
using `org-effort-durations' when computing clocksum durations.
(org-minutes-to-clocksum-string): Use the new option.

* org-clock.el (org-clocktable-write-default): Let-bind
`org-time-clocksum-use-effort-durations' to a new clocktable
parameter ":effort-durations".

Thanks to Sébastien Vauban for pointing the inconsistency.
---
 lisp/org-clock.el |  2 ++
 lisp/org.el       | 90 ++++++++++++++++++++++++++++++++++++-------------------
 2 files changed, 61 insertions(+), 31 deletions(-)

diff --git a/lisp/org-clock.el b/lisp/org-clock.el
index 83ff459..5e74332 100644
--- a/lisp/org-clock.el
+++ b/lisp/org-clock.el
@@ -2316,6 +2316,8 @@ from the dynamic block definition."
 	 (maxlevel (or (plist-get params :maxlevel) 3))
 	 (emph (plist-get params :emphasize))
 	 (level-p (plist-get params :level))
+	 (org-time-clocksum-use-effort-durations
+	  (plist-get params :effort-durations))
 	 (timestamp (plist-get params :timestamp))
 	 (properties (plist-get params :properties))
 	 (ntcol (max 1 (or (plist-get params :tcolumns) 100)))
diff --git a/lisp/org.el b/lisp/org.el
index 78429a7..88d13a0 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -2774,6 +2774,8 @@ means durations longer than a day will be expressed in days and
 minutes, and durations less than a day will be expressed entirely
 in minutes (even for durations longer than an hour)."
   :group 'org-time
+  :group 'org-clock
+  :version "24.3"
   :type '(choice (string :tag "Format string")
 		 (set :tag "Plist"
 		      (group :inline t (const :tag "Years" :years)
@@ -2808,9 +2810,24 @@ in minutes (even for durations longer than an hour)."
 			     (const t)))))
 
 (defcustom org-time-clocksum-use-fractional nil
-  "If non-nil, \\[org-clock-display] uses fractional times.
-org-mode generates a time duration."
+  "When non-nil, \\[org-clock-display] uses fractional times.
+See `org-time-clocksum-format' for more on time clock formats."
   :group 'org-time
+  :group 'org-clock
+  :version "24.3"
+  :type 'boolean)
+
+(defcustom org-time-clocksum-use-effort-durations t
+  "When non-nil, \\[org-clock-display] uses effort durations.
+E.g. by default, one day is considered to be a 8 hours effort,
+so a task that has been clocked for 16 hours will be displayed
+as during 2 days in the clock display or in the clocktable.
+
+See `org-effort-durations' on how to set effort durations
+and `org-time-clocksum-format' for more on time clock formats."
+  :group 'org-time
+  :group 'org-clock
+  :version "24.3"
   :type 'boolean)
 
 (defcustom org-time-clocksum-fractional-format "%.2f"
@@ -16873,72 +16890,83 @@ If there is already a time stamp at the cursor position, update it."
   "Format number of minutes as a clocksum string.
 The format is determined by `org-time-clocksum-format',
 `org-time-clocksum-use-fractional' and
-`org-time-clocksum-fractional-format'."
-  (let ((clocksum "") fmt n)
+`org-time-clocksum-fractional-format' and
+`org-time-clocksum-use-effort-durations'."
+  (let ((clocksum "") h d w mo y fmt n)
+    (setq h (if org-time-clocksum-use-effort-durations
+		(cdr (assoc "h" org-effort-durations)) 60)
+	  d (if org-time-clocksum-use-effort-durations
+		(/ (cdr (assoc "d" org-effort-durations)) h) 24)
+	  w (if org-time-clocksum-use-effort-durations
+		(/ (cdr (assoc "w" org-effort-durations)) (* d h)) 7)
+	  mo (if org-time-clocksum-use-effort-durations
+		 (/ (cdr (assoc "m" org-effort-durations)) (* d h)) 30)
+	  y (if org-time-clocksum-use-effort-durations
+		(/ (cdr (assoc "y" org-effort-durations)) (* d h)) 365))
     ;; fractional format
     (if org-time-clocksum-use-fractional
 	(cond
 	 ;; single format string
 	 ((stringp org-time-clocksum-fractional-format)
-	  (format org-time-clocksum-fractional-format (/ m 60.0)))
+	  (format org-time-clocksum-fractional-format (/ m (float h))))
 	 ;; choice of fractional formats for different time units
 	 ((and (setq fmt (plist-get org-time-clocksum-fractional-format :years))
-	       (> (/ (truncate m) (* 365 24 60)) 0))
-	  (format fmt (/ m (* 365 24 60.0))))
+	       (> (/ (truncate m) (* y d h)) 0))
+	  (format fmt (/ m (* y d (float h)))))
 	 ((and (setq fmt (plist-get org-time-clocksum-fractional-format :months))
-	       (> (/ (truncate m) (* 30 24 60)) 0))
-	  (format fmt (/ m (* 30 24 60.0))))
+	       (> (/ (truncate m) (* mo d h)) 0))
+	  (format fmt (/ m (* mo d (float h)))))
 	 ((and (setq fmt (plist-get org-time-clocksum-fractional-format :weeks))
-	       (> (/ (truncate m) (* 7 24 60)) 0))
-	  (format fmt (/ m (* 7 24 60.0))))
+	       (> (/ (truncate m) (* w d h)) 0))
+	  (format fmt (/ m (* w d (float h)))))
 	 ((and (setq fmt (plist-get org-time-clocksum-fractional-format :days))
-	       (> (/ (truncate m) (* 24 60)) 0))
-	  (format fmt (/ m (* 24 60.0))))
+	       (> (/ (truncate m) (* d h)) 0))
+	  (format fmt (/ m (* d (float h)))))
 	 ((and (setq fmt (plist-get org-time-clocksum-fractional-format :hours))
-	       (> (/ (truncate m) 60) 0))
-	  (format fmt (/ m 60.0)))
+	       (> (/ (truncate m) h) 0))
+	  (format fmt (/ m (float h))))
 	 ((setq fmt (plist-get org-time-clocksum-fractional-format :minutes))
 	  (format fmt m))
 	 ;; fall back to smallest time unit with a format
 	 ((setq fmt (plist-get org-time-clocksum-fractional-format :hours))
-	  (format fmt (/ m 60.0)))
+	  (format fmt (/ m (float h))))
 	 ((setq fmt (plist-get org-time-clocksum-fractional-format :days))
-	  (format fmt (/ m (* 24 60.0))))
+	  (format fmt (/ m (* d (float h)))))
 	 ((setq fmt (plist-get org-time-clocksum-fractional-format :weeks))
-	  (format fmt (/ m (* 7 24 60.0))))
+	  (format fmt (/ m (* w d (float h)))))
 	 ((setq fmt (plist-get org-time-clocksum-fractional-format :months))
-	  (format fmt (/ m (* 30 24 60.0))))
+	  (format fmt (/ m (* mo d (float h)))))
 	 ((setq fmt (plist-get org-time-clocksum-fractional-format :years))
-	  (format fmt (/ m (* 365 24 60.0)))))
+	  (format fmt (/ m (* y d (float h))))))
       ;; standard (non-fractional) format, with single format string
       (if (stringp org-time-clocksum-format)
-	  (format org-time-clocksum-format (setq n (/ m 60)) (- m (* 60 n)))
+	  (format org-time-clocksum-format (setq n (/ m h)) (- m (* h n)))
 	;; separate formats components
 	(and (setq fmt (plist-get org-time-clocksum-format :years))
-	     (or (> (setq n (/ (truncate m) (* 365 24 60))) 0)
+	     (or (> (setq n (/ (truncate m) (* y d h))) 0)
 		 (plist-get org-time-clocksum-format :require-years))
 	     (setq clocksum (concat clocksum (format fmt n))
-		   m (- m (* n 365 24 60))))
+		   m (- m (* n y d h))))
 	(and (setq fmt (plist-get org-time-clocksum-format :months))
-	     (or (> (setq n (/ (truncate m) (* 30 24 60))) 0)
+	     (or (> (setq n (/ (truncate m) (* mo d h))) 0)
 		 (plist-get org-time-clocksum-format :require-months))
 	     (setq clocksum (concat clocksum (format fmt n))
-		   m (- m (* n 30 24 60))))
+		   m (- m (* n mo d h))))
 	(and (setq fmt (plist-get org-time-clocksum-format :weeks))
-	     (or (> (setq n (/ (truncate m) (* 7 24 60))) 0)
+	     (or (> (setq n (/ (truncate m) (* w d h))) 0)
 		 (plist-get org-time-clocksum-format :require-weeks))
 	     (setq clocksum (concat clocksum (format fmt n))
-		   m (- m (* n 7 24 60))))
+		   m (- m (* n w d h))))
 	(and (setq fmt (plist-get org-time-clocksum-format :days))
-	     (or (> (setq n (/ (truncate m) (* 24 60))) 0)
+	     (or (> (setq n (/ (truncate m) (* d h))) 0)
 		 (plist-get org-time-clocksum-format :require-days))
 	     (setq clocksum (concat clocksum (format fmt n))
-		   m (- m (* n 24 60))))
+		   m (- m (* n d h))))
 	(and (setq fmt (plist-get org-time-clocksum-format :hours))
-	     (or (> (setq n (/ (truncate m) 60)) 0)
+	     (or (> (setq n (/ (truncate m) h)) 0)
 		 (plist-get org-time-clocksum-format :require-hours))
 	     (setq clocksum (concat clocksum (format fmt n))
-		   m (- m (* n 60))))
+		   m (- m (* n h))))
 	(and (setq fmt (plist-get org-time-clocksum-format :minutes))
 	     (or (> m 0) (plist-get org-time-clocksum-format :require-minutes))
 	     (setq clocksum (concat clocksum (format fmt m))))
-- 
1.8.0.3


[-- Attachment #3: Type: text/plain, Size: 14 bytes --]


-- 
 Bastien

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

* Re: Multiple notions for what's a day
  2013-01-05 17:23 ` Bastien
@ 2013-01-07 20:44   ` Bastien
  2013-01-17 21:49     ` Sebastien Vauban
  0 siblings, 1 reply; 4+ messages in thread
From: Bastien @ 2013-01-07 20:44 UTC (permalink / raw)
  To: Sebastien Vauban; +Cc: public-emacs-orgmode-mXXj517/zsQ



Hi Sébastien,

Bastien <bzg@altern.org> writes:

> Indeed, there is a problem here.
>
> Please try the attached patch against master

I've now applied the patch in master.

Let me know if you see anything weird.

Thanks,

-- 
 Bastien

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

* Re: Multiple notions for what's a day
  2013-01-07 20:44   ` Bastien
@ 2013-01-17 21:49     ` Sebastien Vauban
  0 siblings, 0 replies; 4+ messages in thread
From: Sebastien Vauban @ 2013-01-17 21:49 UTC (permalink / raw)
  To: emacs-orgmode-mXXj517/zsQ

Hello Bastien,

Bastien wrote:
> Bastien <bzg-whniv8GeeGkdnm+yROfE0A@public.gmane.org> writes:
>
>> Indeed, there is a problem here.
>>
>> Please try the attached patch against master
>
> I've now applied the patch in master.
>
> Let me know if you see anything weird.

I'm just slowly coming back to life ;-), and reading this ML again.

I'll test the above soon, and report any trouble. Thanks!

Best regards,
  Seb

-- 
Sebastien Vauban

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

end of thread, other threads:[~2013-01-17 21:49 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-12-31 10:25 Multiple notions for what's a day Sebastien Vauban
2013-01-05 17:23 ` Bastien
2013-01-07 20:44   ` Bastien
2013-01-17 21:49     ` Sebastien Vauban

Code repositories for project(s) associated with this 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).