mirror of
https://github.com/SqrtMinusOne/pomm.el.git
synced 2025-12-10 14:43:03 +03:00
display total time worked, braked and tracked
This commit is contained in:
parent
42f03d6ff2
commit
39fd164b1d
1 changed files with 22 additions and 10 deletions
|
|
@ -248,14 +248,15 @@ return it, otherwise, return a value like a calc error."
|
||||||
('nil 0)))
|
('nil 0)))
|
||||||
0))
|
0))
|
||||||
|
|
||||||
(defun pomm-third-time--worked-time ()
|
(defun pomm-third-time--total-time (&optional kind)
|
||||||
"Get total time worked in the current iteration."
|
"Get total time spent in `state` in the current iteration."
|
||||||
(let ((iteration (alist-get 'iteration
|
(let* ((kind (if kind kind 'work))
|
||||||
(alist-get 'current pomm-third-time--state)))
|
(iteration (alist-get 'iteration
|
||||||
(current-kind (alist-get 'kind (alist-get 'current pomm-third-time--state))))
|
(alist-get 'current pomm-third-time--state)))
|
||||||
|
(current-kind (alist-get 'kind (alist-get 'current pomm-third-time--state))))
|
||||||
(apply
|
(apply
|
||||||
#'+
|
#'+
|
||||||
(if (eq current-kind 'work)
|
(if (eq current-kind kind)
|
||||||
(pomm-third-time--current-period-time)
|
(pomm-third-time--current-period-time)
|
||||||
0)
|
0)
|
||||||
(mapcar
|
(mapcar
|
||||||
|
|
@ -265,9 +266,10 @@ return it, otherwise, return a value like a calc error."
|
||||||
(seq-filter
|
(seq-filter
|
||||||
(lambda (item)
|
(lambda (item)
|
||||||
(and (= (alist-get 'iteration item) iteration)
|
(and (= (alist-get 'iteration item) iteration)
|
||||||
(eq (alist-get 'kind item) 'work)))
|
(eq (alist-get 'kind item) kind)))
|
||||||
(alist-get 'history pomm-third-time--state))))))
|
(alist-get 'history pomm-third-time--state))))))
|
||||||
|
|
||||||
|
|
||||||
(defun pomm-third-time--need-switch-p ()
|
(defun pomm-third-time--need-switch-p ()
|
||||||
"Check if the break period has to end."
|
"Check if the break period has to end."
|
||||||
(and
|
(and
|
||||||
|
|
@ -536,7 +538,9 @@ KIND is the same as in `pomm-third-time--state'"
|
||||||
(iteration (alist-get 'iteration
|
(iteration (alist-get 'iteration
|
||||||
(alist-get 'current pomm-third-time--state)))
|
(alist-get 'current pomm-third-time--state)))
|
||||||
(break-time (pomm-third-time--break-time))
|
(break-time (pomm-third-time--break-time))
|
||||||
(period-time (pomm-third-time--current-period-time)))
|
(period-time (pomm-third-time--current-period-time))
|
||||||
|
(total-work (pomm-third-time--total-time 'work))
|
||||||
|
(total-break (pomm-third-time--total-time 'break)))
|
||||||
(concat
|
(concat
|
||||||
(format "Iteration #%d. " iteration)
|
(format "Iteration #%d. " iteration)
|
||||||
"State: "
|
"State: "
|
||||||
|
|
@ -556,9 +560,17 @@ KIND is the same as in `pomm-third-time--state'"
|
||||||
(propertize
|
(propertize
|
||||||
(pomm-third-time--format-period break-time)
|
(pomm-third-time--format-period break-time)
|
||||||
'face 'success)
|
'face 'success)
|
||||||
". Total time worked: "
|
".\nTotal time worked: "
|
||||||
(propertize
|
(propertize
|
||||||
(pomm-third-time--format-period (pomm-third-time--worked-time))
|
(pomm-third-time--format-period total-work)
|
||||||
|
'face 'success)
|
||||||
|
". Total time braked: "
|
||||||
|
(propertize
|
||||||
|
(pomm-third-time--format-period total-break)
|
||||||
|
'face 'success)
|
||||||
|
". Total time tracked: "
|
||||||
|
(propertize
|
||||||
|
(pomm-third-time--format-period (+ total-work total-break))
|
||||||
'face 'success))))))
|
'face 'success))))))
|
||||||
|
|
||||||
(defclass pomm-third-time--transient-history (transient-suffix)
|
(defclass pomm-third-time--transient-history (transient-suffix)
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue