emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Bug: Total shown clocked time of inlinetask includes the clocking of the parent task [9.3.7 (release_9.3.7-783-gd307b6 @ /home/yantar92/.emacs.d/straight/build/org/)]
@ 2020-08-15  4:18 Ihor Radchenko
  2020-08-22  4:34 ` Kyle Meyer
  0 siblings, 1 reply; 4+ messages in thread
From: Ihor Radchenko @ 2020-08-15  4:18 UTC (permalink / raw)
  To: emacs-orgmode

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


Remember to cover the basics, that is, what you expected to happen and
what in fact did happen.  You don't know how to make a good report?  See

     https://orgmode.org/manual/Feedback.html#Feedback

Your bug report will be posted to the Org mailing list.
------------------------------------------------------------------------

I have noticed that total clocked time shown while clocked-in into
inlinetask includes the clocked time of its parent task.

Expected behaviour: only the clocking time for the inline task itself
should be shown.

This can be fixed if org-clock-sum-current-item consider the case when
point is at inlinetask.  The proposed fix is attached.

Best,
Ihor


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

diff --git a/lisp/org-clock.el b/lisp/org-clock.el
index 291b634af..6c08142c7 100644
--- a/lisp/org-clock.el
+++ b/lisp/org-clock.el
@@ -1956,7 +1956,12 @@ PROPNAME lets you set a custom text property instead of :org-clock-minutes."
   "Return time, clocked on current item in total."
   (save-excursion
     (save-restriction
-      (org-narrow-to-subtree)
+      (if (and (featurep 'org-inlinetask)
+	       (or (org-inlinetask-at-task-p)
+		   (org-inlinetask-in-task-p)))
+	  (narrow-to-region (save-excursion (org-inlinetask-goto-beginning) (point))
+			    (save-excursion (org-inlinetask-goto-end) (point)))
+	(org-narrow-to-subtree))
       (org-clock-sum tstart)
       org-clock-file-total-minutes)))
 

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



Emacs  : GNU Emacs 28.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.20, cairo version 1.16.0)
 of 2020-08-08
Package: Org mode version 9.3.7 (release_9.3.7-783-gd307b6 @ /home/yantar92/.emacs.d/straight/build/org/)

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

* Re: Bug: Total shown clocked time of inlinetask includes the clocking of the parent task [9.3.7 (release_9.3.7-783-gd307b6 @ /home/yantar92/.emacs.d/straight/build/org/)]
  2020-08-15  4:18 Bug: Total shown clocked time of inlinetask includes the clocking of the parent task [9.3.7 (release_9.3.7-783-gd307b6 @ /home/yantar92/.emacs.d/straight/build/org/)] Ihor Radchenko
@ 2020-08-22  4:34 ` Kyle Meyer
  2020-08-22  8:43   ` Ihor Radchenko
  0 siblings, 1 reply; 4+ messages in thread
From: Kyle Meyer @ 2020-08-22  4:34 UTC (permalink / raw)
  To: Ihor Radchenko; +Cc: emacs-orgmode

Ihor Radchenko writes:

> I have noticed that total clocked time shown while clocked-in into
> inlinetask includes the clocked time of its parent task.
>
> Expected behaviour: only the clocking time for the inline task itself
> should be shown.
>
> This can be fixed if org-clock-sum-current-item consider the case when
> point is at inlinetask.  The proposed fix is attached.

Thank you.  Please send the patch with a commit message, as described at
<https://orgmode.org/worg/org-contribute.html>.


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

* Re: Bug: Total shown clocked time of inlinetask includes the clocking of the parent task [9.3.7 (release_9.3.7-783-gd307b6 @ /home/yantar92/.emacs.d/straight/build/org/)]
  2020-08-22  4:34 ` Kyle Meyer
@ 2020-08-22  8:43   ` Ihor Radchenko
  2020-08-24  2:44     ` Kyle Meyer
  0 siblings, 1 reply; 4+ messages in thread
From: Ihor Radchenko @ 2020-08-22  8:43 UTC (permalink / raw)
  To: Kyle Meyer; +Cc: emacs-orgmode

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

> Thank you.  Please send the patch with a commit message, as described at
> <https://orgmode.org/worg/org-contribute.html>.

See the attached. Let me know if anything is missing.

Best,
Ihor


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-org-clock.el-Fix-calculated-clocking-sum-in-inlineta.patch --]
[-- Type: text/x-diff, Size: 1381 bytes --]

From 3f7b54f0100013c9a37be10256538f76abdd7112 Mon Sep 17 00:00:00 2001
From: Ihor Radchenko <yantar92@gmail.com>
Date: Sat, 15 Aug 2020 16:31:48 +0800
Subject: [PATCH] org-clock.el: Fix calculated clocking sum in inlinetasks

* lisp/org-clock.el (org-clock-sum-current-item): Do not include
clocked time from the parent when inside inlinetask.

Calling `org-narrow-to-subtree' from inside inlinetask would narrow to
the parent's subtree (correct behaviour).  However, it is not what we
want when calculating the clocking sum.  Inlinetask case should be
treated specially.
---
 lisp/org-clock.el | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/lisp/org-clock.el b/lisp/org-clock.el
index 0dd495493..6a25f1e18 100644
--- a/lisp/org-clock.el
+++ b/lisp/org-clock.el
@@ -1956,7 +1956,12 @@ PROPNAME lets you set a custom text property instead of :org-clock-minutes."
   "Return time, clocked on current item in total."
   (save-excursion
     (save-restriction
-      (org-narrow-to-subtree)
+      (if (and (featurep 'org-inlinetask)
+	       (or (org-inlinetask-at-task-p)
+		   (org-inlinetask-in-task-p)))
+	  (narrow-to-region (save-excursion (org-inlinetask-goto-beginning) (point))
+			    (save-excursion (org-inlinetask-goto-end) (point)))
+	(org-narrow-to-subtree))
       (org-clock-sum tstart)
       org-clock-file-total-minutes)))
 
-- 
2.26.2


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



Kyle Meyer <kyle@kyleam.com> writes:

> Ihor Radchenko writes:
>
>> I have noticed that total clocked time shown while clocked-in into
>> inlinetask includes the clocked time of its parent task.
>>
>> Expected behaviour: only the clocking time for the inline task itself
>> should be shown.
>>
>> This can be fixed if org-clock-sum-current-item consider the case when
>> point is at inlinetask.  The proposed fix is attached.
>
> Thank you.  Please send the patch with a commit message, as described at
> <https://orgmode.org/worg/org-contribute.html>.

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

* Re: Bug: Total shown clocked time of inlinetask includes the clocking of the parent task [9.3.7 (release_9.3.7-783-gd307b6 @ /home/yantar92/.emacs.d/straight/build/org/)]
  2020-08-22  8:43   ` Ihor Radchenko
@ 2020-08-24  2:44     ` Kyle Meyer
  0 siblings, 0 replies; 4+ messages in thread
From: Kyle Meyer @ 2020-08-24  2:44 UTC (permalink / raw)
  To: Ihor Radchenko; +Cc: emacs-orgmode

Ihor Radchenko writes:

> See the attached. Let me know if anything is missing.

Thanks.  Applied in 7b657c50e, with code on top to silence the
byte-compiler.


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

end of thread, other threads:[~2020-08-24  2:45 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-15  4:18 Bug: Total shown clocked time of inlinetask includes the clocking of the parent task [9.3.7 (release_9.3.7-783-gd307b6 @ /home/yantar92/.emacs.d/straight/build/org/)] Ihor Radchenko
2020-08-22  4:34 ` Kyle Meyer
2020-08-22  8:43   ` Ihor Radchenko
2020-08-24  2:44     ` Kyle Meyer

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