diff --git a/lisp/org-colview.el b/lisp/org-colview.el index 7aa5ef645..da9a11104 100644 --- a/lisp/org-colview.el +++ b/lisp/org-colview.el @@ -1345,18 +1345,32 @@ (defun org-columns--summary-estimate (estimates _) The mean and variance of the result will be the sum of the means and variances (respectively) of the individual estimates." (let ((mean 0) - (var 0)) + (var 0) + (durationp + (catch :no-match + (dolist (e estimates) + (dolist (val (split-string e "-")) + (unless (org-duration-p val) (throw :no-match nil)))) + 'all-values-are-durations))) (dolist (e estimates) - (pcase (mapcar #'string-to-number (split-string e "-")) + (pcase (mapcar + (if durationp + #'org-duration-to-minutes + #'string-to-number) + (split-string e "-")) (`(,low ,high) (let ((m (/ (+ low high) 2.0))) (cl-incf mean m) (cl-incf var (- (/ (+ (* low low) (* high high)) 2.0) (* m m))))) (`(,value) (cl-incf mean value)))) (let ((sd (sqrt var))) - (format "%s-%s" - (format "%.0f" (- mean sd)) - (format "%.0f" (+ mean sd)))))) + (if durationp + (format "%s - %s" + (org-duration-from-minutes (- mean sd)) + (org-duration-from-minutes (+ mean sd))) + (format "%s-%s" + (format "%.0f" (- mean sd)) + (format "%.0f" (+ mean sd)))))))