emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Bernt Hansen <bernt@norang.ca>
To: Peter Jones <mlists@pmade.com>
Cc: Carsten Dominik <cdominik@newartisans.com>,
	Ben Finney <ben+emacs@benfinney.id.au>,
	emacs-orgmode@gnu.org
Subject: Re: Bug: No property change from ‘org-clock-sum’
Date: Fri, 06 May 2011 12:32:52 -0400	[thread overview]
Message-ID: <87d3jviybv.fsf@norang.ca> (raw)
In-Reply-To: m2liyjq48q.fsf@pmade.com

Peter Jones <mlists@pmade.com> writes:

> Bernt Hansen <bernt@norang.ca> writes:
>> The org-invoice.el contributed file created by Peter Jones uses a
>> CLOCKSUM property but I'm not sure if this is intended to be updated
>> manually or automatically from the clocking lines in org.  I've CC-ed
>> Peter in case he can shed any light on this.
>
> IIRC, when I wrote org-invoice.el the function (org-clock-sum) updated
> the CLOCKSUM entry in the property drawer.  I don't remember anything
> about text properties being updated, and that doesn't seem very useful
> to me.

Hi Peter,

Carsten just pushed a fix so org-invoice.el can again access the
CLOCKSUM special property.

I've mocked up a sample task tree with clock times and dates and tried
to generate an invoice using a rate of $60 - which makes each clock
minute $1.  The total time in the tree is 55 minutes so this invoice
should be $55 but the total is $115.

Please let me know if I'm doing this completely wrong.

org-invoice.el has a number of problems on a sample tree I ran this
against.

The clocked time in this file is as follows:

#+BEGIN: columnview :hlines 1 :id: local
| Task                       | Estimated Effort | CLOCKSUM |
|----------------------------+------------------+----------|
| ** DONE Project Foo        |                  |     0:55 |
| *** DONE Task 1 for foo    |                  |     0:05 |
| *** DONE Task 2 for foo    |                  |     0:20 |
| **** DONE Task 2.1 for foo |                  |     0:05 |
| *** DONE Task 3 for foo    |                  |     0:20 |
| **** DONE Task 3.1 for foo |                  |     0:05 |
| *** DONE Task 4 for foo    |                  |     0:05 |
#+END:

There are 5 minutes clocked in the Project Foo task and all other
clocked times are in the subtasks.  There are 55 minutes total clocked
on this project.

The clock detail per task is

| Task                       | Clocked Minutes |
|----------------------------+-----------------|
| ** DONE Project Foo        |            0:05 |
| *** DONE Task 1 for foo    |            0:05 |
| *** DONE Task 2 for foo    |            0:15 |
| **** DONE Task 2.1 for foo |            0:05 |
| *** DONE Task 3 for foo    |            0:15 |
| **** DONE Task 3.1 for foo |            0:05 |
| *** DONE Task 4 for foo    |            0:05 |


and the resulting invoice looks like this:

| Task / Date               | Time |  Price |
|---------------------------+------+--------|
| Tuesday, April 19, 2011   | 0:55 |  55.00 |
| DONE Project Foo          | 0:55 |  55.00 |
|---------------------------+------+--------|
| Monday, April 18, 2011    | 0:05 |   5.00 |
| DONE Task 1 for foo       | 0:05 |   5.00 |
|---------------------------+------+--------|
| Tuesday, April 19, 2011   | 0:25 |  25.00 |
| DONE Task 2 for foo       | 0:20 |  20.00 |
| DONE Task 2.1 for foo     | 0:05 |   5.00 |
|---------------------------+------+--------|
| Wednesday, April 20, 2011 | 0:25 |  25.00 |
| DONE Task 3 for foo       | 0:20 |  20.00 |
| DONE Task 3.1 for foo     | 0:05 |   5.00 |
|---------------------------+------+--------|
| Tuesday, April 19, 2011   | 0:05 |   5.00 |
| DONE Task 3 for foo       | 0:05 |   5.00 |
|---------------------------+------+--------|
| Total:                    | 1:55 | 115.00 |


There is double accounting of clock times in the invoice.

   1) Trees with subtasks are double accounted for time.
      This inflates the invoice and is incorrect.
   2) The total time at the bottom of the invoice also includes double
      accounted for clock times.

The 3rd entry

|-------------------------+------+-------|
| Tuesday, April 19, 2011 | 0:25 | 25.00 |
| DONE Task 2 for foo     | 0:20 | 20.00 |
| DONE Task 2.1 for foo   | 0:05 |  5.00 |
|-------------------------+------+-------|

is really only 20 minutes long with 15 minutes clocked in the Task 2
parent task and 5 minutes clocked in the Task 2.1 subtask.  The total
for the day should be 0:20 not 0:25 which also affects the invoice total
at the bottom.

Ditto for the 4th entry.

The Project Foo entry includes all 55 minutes for the project and is
added to all of the subtask entries which inflates the total for the
invoice.

Regards,
Bernt


--8<---------------cut here---------------start------------->8---
* Invoices
** DONE Project Foo
CLOSED: [2011-04-19 Tue 13:57]
:LOGBOOK:
- State "DONE"       from "STARTED"    [2011-04-19 Tue 13:57]
CLOCK: [2011-04-18 Mon 16:13]--[2011-04-18 Mon 16:18] =>  0:05
:END:
:PROPERTIES:
:RATE: 60
:END:
[2011-04-18 Mon 15:36]

#+BEGIN: columnview :hlines 1 :id: local
| Task                       | Estimated Effort | CLOCKSUM |
|----------------------------+------------------+----------|
| ** DONE Project Foo        |                  |     0:55 |
| *** DONE Task 1 for foo    |                  |     0:05 |
| *** DONE Task 2 for foo    |                  |     0:20 |
| **** DONE Task 2.1 for foo |                  |     0:05 |
| *** DONE Task 3 for foo    |                  |     0:20 |
| **** DONE Task 3.1 for foo |                  |     0:05 |
| *** DONE Task 4 for foo    |                  |     0:05 |
#+END:


#+BEGIN: invoice
| Task / Date               | Time |  Price |
|---------------------------+------+--------|
| Tuesday, April 19, 2011   | 0:55 |  55.00 |
| DONE Project Foo          | 0:55 |  55.00 |
|---------------------------+------+--------|
| Monday, April 18, 2011    | 0:05 |   5.00 |
| DONE Task 1 for foo       | 0:05 |   5.00 |
|---------------------------+------+--------|
| Tuesday, April 19, 2011   | 0:25 |  25.00 |
| DONE Task 2 for foo       | 0:20 |  20.00 |
| DONE Task 2.1 for foo     | 0:05 |   5.00 |
|---------------------------+------+--------|
| Wednesday, April 20, 2011 | 0:25 |  25.00 |
| DONE Task 3 for foo       | 0:20 |  20.00 |
| DONE Task 3.1 for foo     | 0:05 |   5.00 |
|---------------------------+------+--------|
| Tuesday, April 19, 2011   | 0:05 |   5.00 |
| DONE Task 4 for foo       | 0:05 |   5.00 |
|---------------------------+------+--------|
| Total:                    | 1:55 | 115.00 |

#+END:

*** DONE Task 1 for foo
SCHEDULED: <2011-04-18 Mon> CLOSED: [2011-04-18 Mon 12:09]
:LOGBOOK:
- State "DONE"       from "TODO"       [2011-04-18 Mon 12:09]
CLOCK: [2011-04-18 Mon 10:17]--[2011-04-18 Mon 10:22] =>  0:05
:END:
[2011-04-17 Sun 06:33]

*** DONE Task 2 for foo
CLOSED: [2011-04-19 Tue 13:56]
:LOGBOOK:
- State "DONE"       from "TODO"       [2011-04-19 Tue 13:56]
CLOCK: [2011-04-18 Mon 18:20]--[2011-04-18 Mon 18:35] =>  0:15
:END:
[2011-04-18 Mon 18:12]
**** DONE Task 2.1 for foo
CLOSED: [2011-04-19 Tue 13:56]
:LOGBOOK:
- State "DONE"       from "STARTED"    [2011-04-19 Tue 13:56]
CLOCK: [2011-04-19 Tue 13:56]--[2011-04-19 Tue 14:01] =>  0:05
:END:
[2011-04-19 Tue 12:05]

*** DONE Task 3 for foo
CLOSED: [2011-04-20 Wed 13:56]
:LOGBOOK:
- State "DONE"       from "TODO"       [2011-04-20 Wed 13:56]
CLOCK: [2011-04-19 Tue 18:20]--[2011-04-19 Tue 18:35] =>  0:15
:END:
[2011-04-19 Tue 18:12]
**** DONE Task 3.1 for foo
CLOSED: [2011-04-20 Wed 13:56]
:LOGBOOK:
- State "DONE"       from "STARTED"    [2011-04-20 Wed 13:56]
CLOCK: [2011-04-20 Wed 13:56]--[2011-04-20 Wed 14:01] =>  0:05
:END:
[2011-04-20 Wed 12:05]

*** DONE Task 4 for foo
CLOSED: [2011-04-19 Tue 17:01]
:LOGBOOK:
- State "DONE"       from "STARTED"    [2011-04-19 Tue 17:01]
CLOCK: [2011-04-19 Tue 16:58]--[2011-04-19 Tue 17:03] =>  0:05
:END:
[2011-04-19 Tue 16:58]
--8<---------------cut here---------------end--------------->8---

  reply	other threads:[~2011-05-06 16:34 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-04-07 21:51 Bug: No property change from ‘org-clock-sum’ Ben Finney
2011-05-06  0:14 ` Ben Finney
2011-05-06  1:43   ` Bernt Hansen
2011-05-06  6:34     ` Ben Finney
2011-05-06 13:56       ` Bernt Hansen
2011-05-06 15:30         ` Carsten Dominik
2011-05-06 15:55           ` Bernt Hansen
2011-05-07  0:48           ` Ben Finney
2011-05-06 14:43     ` Peter Jones
2011-05-06 16:32       ` Bernt Hansen [this message]
2011-05-06 15:31 ` Carsten Dominik

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87d3jviybv.fsf@norang.ca \
    --to=bernt@norang.ca \
    --cc=ben+emacs@benfinney.id.au \
    --cc=cdominik@newartisans.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=mlists@pmade.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).