Paste number 335713: automatic reports

Index of paste annotations: 1

Paste number 335713: automatic reports
Pasted by: yanmcbe
When:5 years, 2 weeks ago
Share:Tweet this! | http://paste.lisp.org/+771D
Channel:None
Paste contents:
Raw Source | XML | Display As
* What I want to do
  I want to periodically and manually update results-ecm with a
  single command. E.g. a C-c C-c on the table, or running a source
  block, or running a command with M-x or a keybind.
* What doesn't work like I want it right now
  1. Before I run my commands I have to set
     org-time-clocksum-use-fractional to t using C-x C-e. I don't
     want to leave it permanently like that because it changes
     the format throughout org-mode. So at the end I need to set
     it back, manually again.
  2. I have to update percentage-done-ecm manually using C-c C-c first.
  3. I cannot update results-ecm using a single C-c C-c because I
     can't get the 2 TBLFM lines on one line. It may be possible
     using lisp forms, but I did not manage with my limited
     understanding of progn and elisp in general.
  4. Sharp eyes will see the problem of calculating with
     CLOCKTABLE and EFFORT values. That's an issue for another
     day ;-)
* Notes and questions
  1. It is not neccessary to create the extra column in
     percentage-done-ecm. By the way, for that to work
     org-table-formula-create-columns needs to be non-nil.
  2. What I'm looking for is some pointers in a direction of a
     solution because I'm yak-shaving hard on this. E.g. would
     the simplest solution be to figure out to create a defun
     that just looks for these named tables and executes the
     commands I now do manually?
  3. What kind of block can I wrap the results-ecm table in so I
     can fold it out of the way like the columnview table above
     it?
       
* ECM
(setq org-time-clocksum-use-fractional t)
(setq org-time-clocksum-use-fractional nil)
#+BEGIN: columnview :hlines 1 :id 1 :maxlevel 6 :comment "TODO: set maxlevel back to 1 when copying the ECM to its own file"
#+NAME: percentage-done-ecm
#+TITLE: Work completion
| ITEM           | Effort | Elapsed | TODO | Completion |
|----------------+--------+---------+------+------------|
| ****** Project | 110.00 |   11.00 |      |       10.0 |
#+TBLFM: @<$5=string("Completion")::@>$5=100*@2$3/@2$2;%0.1f
#+END

#+NAME: results-ecm
#+TITLE: Results of work
|------------------+---------+------------|
| Date             | Elapsed | Completion |
|------------------+---------+------------|
| [2017-01-02 Mon] |       0 |        0.0 |
| [2017-01-04 Wed] |    11.0 |       10.0 |
|------------------+---------+------------|
#+TBLFM: @>$1='(progn (org-table-insert-row 0) (format-time-string "[%Y-%m-%d %a]"))
#+TBLFM: @>$2=remote(percentage-done-ecm, @2$3);%0.1f::@>$3=remote(percentage-done-ecm, @2$5);%0.1f
* Dummy project
  :PROPERTIES:
  :ID:       1
  :END:
** DONE Low-hanging fruit
   CLOSED: [2017-01-04 Wed 16:12]
   :PROPERTIES:
   :Effort:   10:00
   :END:
   :LOGBOOK:
   - State "DONE"       from "TODO"       [2017-01-04 Wed 16:12]
   CLOCK: [2017-01-04 Wed 05:13]--[2017-01-04 Wed 16:13] => 11:00
   :END:
** TODO Muscle-work
   :PROPERTIES:
   :Effort:   100:00
   :END:

Annotations for this paste:

Annotation number 1: fixed ECM for standalone
Pasted by: yanmcbe
When:5 years, 2 weeks ago
Share:Tweet this! | http://paste.lisp.org/+771D/1
Paste contents:
Raw Source | Display As
#+COLUMNS: %36ITEM %8Effort{:} %CLOCKSUM(Elapsed) %5TODO %8TAGS

* What I want to do
  I want to periodically and manually update results-ecm with a
  single command. E.g. a C-c C-c on the table, or running a source
  block, or running a command with M-x or a keybind.
* What doesn't work like I want it right now
  1. Before I run my commands I have to set
     org-time-clocksum-use-fractional to t using C-x C-e. I don't
     want to leave it permanently like that because it changes
     the format throughout org-mode. So at the end I need to set
     it back, manually again.
  2. I have to update percentage-done-ecm manually using C-c C-c first.
  3. I cannot update results-ecm using a single C-c C-c because I
     can't get the 2 TBLFM lines on one line. It may be possible
     using lisp forms, but I did not manage with my limited
     understanding of progn and elisp in general.
  4. Sharp eyes will see the problem of calculating with
     CLOCKTABLE and EFFORT values. That's an issue for another
     day ;-)
* Notes and questions
  1. It is not neccessary to create the extra column in
     percentage-done-ecm. By the way, for that to work
     org-table-formula-create-columns needs to be non-nil.
  2. What I'm looking for is some pointers in a direction of a
     solution because I'm yak-shaving hard on this. E.g. would
     the simplest solution be to figure out to create a defun
     that just looks for these named tables and executes the
     commands I now do manually?
  3. What kind of block can I wrap the results-ecm table in so I
     can fold it out of the way like the columnview table above
     it?
       
* ECM
(setq org-time-clocksum-use-fractional t)
(setq org-time-clocksum-use-fractional nil)
#+BEGIN: columnview :hlines 1 :id 1 :maxlevel 1
#+NAME: percentage-done-ecm
#+TITLE: Work completion
| ITEM            | Effort | Elapsed | TODO | Completion |
|-----------------+--------+---------+------+------------|
#+TBLFM: @<$5=string("Completion")::@>$5=100*@2$3/@2$2;%0.1f
#+END

#+NAME: results-ecm
#+TITLE: Results of work
|------------------+---------+------------|
| Date             | Elapsed | Completion |
|------------------+---------+------------|
| [2017-01-02 Mon] |       0 |        0.0 |
|------------------+---------+------------|
#+TBLFM: @>$1='(progn (org-table-insert-row 0) (format-time-string "[%Y-%m-%d %a]"))
#+TBLFM: @>$2=remote(percentage-done-ecm, @2$3);%0.1f::@>$3=remote(percentage-done-ecm, @2$5);%0.1f
* Dummy project
  :PROPERTIES:
  :ID:       1
  :END:
** DONE Low-hanging fruit
   CLOSED: [2017-01-04 Wed 16:12]
   :PROPERTIES:
   :Effort:   10:00
   :END:
   :LOGBOOK:
   - State "DONE"       from "TODO"       [2017-01-04 Wed 16:12]
   CLOCK: [2017-01-04 Wed 05:13]--[2017-01-04 Wed 16:13] => 11:00
   :END:
** TODO Muscle-work
   :PROPERTIES:
   :Effort:   100:00
   :END:

Colorize as:
Show Line Numbers

Lisppaste pastes can be made by anyone at any time. Imagine a fearsomely comprehensive disclaimer of liability. Now fear, comprehensively.