Browse Source

org-colview: Plain numbers are minutes instead of hours

* lisp/org-colview.el (org-columns--summary-apply-times): Use the same
  rule as everywhere else in Org.
* doc/org-manual.org (Column attributes): Document change.

Reported-by: Bernt Hansen <bernt@norang.ca>
<http://lists.gnu.org/r/emacs-orgmode/2018-05/msg00294.html>
Nicolas Goaziou 2 years ago
parent
commit
fc5ee0f87b
2 changed files with 2 additions and 11 deletions
  1. 1 1
      doc/org-manual.org
  2. 1 10
      lisp/org-colview.el

+ 1 - 1
doc/org-manual.org

@@ -5404,7 +5404,7 @@ optional.  The individual parts have the following meaning:
      | =X=      | Checkbox status, =[X]= if all children are =[X]=.     |
      | =X/=     | Checkbox status, =[n/m]=.                             |
      | =X%=     | Checkbox status, =[n%]=.                              |
-     | =:=      | Sum times, HH:MM, plain numbers are hours.            |
+     | =:=      | Sum times, HH:MM, plain numbers are minutes.          |
      | =:min=   | Smallest time value in column.                        |
      | =:max=   | Largest time value.                                   |
      | =:mean=  | Arithmetic mean of time values.                       |

+ 1 - 10
lisp/org-colview.el

@@ -1110,16 +1110,7 @@ as a canonical duration, i.e., using units defined in
   "Apply FUN to time values TIMES.
 Return the result as a duration."
   (org-duration-from-minutes
-   (apply fun
-	  (mapcar (lambda (time)
-		    ;; Unlike to `org-duration-to-minutes' standard
-		    ;; behavior, we want to consider plain numbers as
-		    ;; hours.  As a consequence, we treat them
-		    ;; differently.
-		    (if (string-match-p "\\`[0-9]+\\(?:\\.[0-9]*\\)?\\'" time)
-			(* 60 (string-to-number time))
-		      (org-duration-to-minutes time)))
-		  times))
+   (apply fun (mapcar #'org-duration-to-minutes times))
    (org-duration-h:mm-only-p times)))
 
 (defun org-columns--compute-spec (spec &optional update)