feat(details): support begin/end in ranges
This commit is contained in:
parent
883f813615
commit
1931e88c85
6
TODO.org
6
TODO.org
|
@ -610,16 +610,18 @@ list of tasks, one day, durations and graphs
|
||||||
list of tasks, one week, durations only
|
list of tasks, one week, durations only
|
||||||
*** statistics
|
*** statistics
|
||||||
list of tasks, one week/month/year [fn:1]
|
list of tasks, one week/month/year [fn:1]
|
||||||
*** details (intervals for a day) [0%]
|
*** details (intervals for a day) [25%]
|
||||||
list of intervals, one day [fn:1]
|
list of intervals, one day [fn:1]
|
||||||
+ [-] commands [50%]
|
+ [-] commands [50%]
|
||||||
1. [X] set [task/key-value] filter [fn:2]
|
1. [X] set [task/key-value] filter [fn:2]
|
||||||
2. [X] set range
|
2. [X] set range
|
||||||
|
1. implement timestamp ranges (e.g. =2021-06-01T12:00+05:30= to =2021-07-03T00:10:29+0530=)
|
||||||
3. [ ] previous/next day
|
3. [ ] previous/next day
|
||||||
4. [ ] set duration format
|
4. [ ] set duration format
|
||||||
+ [ ] with =spark= - vertical sparkline for each interval
|
+ [ ] with =spark= - vertical sparkline for each interval
|
||||||
+ [ ] non-tabular text [fn:3]
|
+ [ ] non-tabular text [fn:3]
|
||||||
+ [ ] when range is a pair with the =car= or the =cdr= being blank, set the respective date to the earliest (if =car= is blank) or the latest (if =cdr= is blank) date available.
|
+ [X] when range is a pair with the =car= or the =cdr= being blank, set the start/stop date to the earliest/latest date available.
|
||||||
|
* not possible with =completing-read-multiple=, which removes blank strings; the simplest solution was to allow "begin"/"end" as inputs.
|
||||||
|
|
||||||
** New frontends I want
|
** New frontends I want
|
||||||
*** task-key-values
|
*** task-key-values
|
||||||
|
|
|
@ -2161,20 +2161,33 @@ TABLE must be a hash table similar to `chronometrist-events'."
|
||||||
(let ((input (completing-read-multiple
|
(let ((input (completing-read-multiple
|
||||||
(concat "Range (blank, ISO-8601 date, "
|
(concat "Range (blank, ISO-8601 date, "
|
||||||
"or two ISO-8601 dates/timestamps): ")
|
"or two ISO-8601 dates/timestamps): ")
|
||||||
(reverse (hash-table-keys chronometrist-events)) nil nil
|
(append '("begin" "end")
|
||||||
(pcase chronometrist-details-range
|
(reverse (hash-table-keys chronometrist-events)))
|
||||||
('nil nil)
|
nil nil (pcase chronometrist-details-range
|
||||||
((pred stringp)
|
('nil nil)
|
||||||
(format "%s" chronometrist-details-range))
|
((pred stringp)
|
||||||
(`(,begin . ,end)
|
(format "%s" chronometrist-details-range))
|
||||||
(format "%s,%s" begin end)))
|
(`(,begin . ,end)
|
||||||
|
(format "%s,%s" begin end)))
|
||||||
'chronometrist-details-range-history)))
|
'chronometrist-details-range-history)))
|
||||||
(pcase input
|
(pcase input
|
||||||
('nil (setq-local chronometrist-details-range nil))
|
('nil (setq-local chronometrist-details-range nil))
|
||||||
(`(,date)
|
(`(,date)
|
||||||
(setq-local chronometrist-details-range date))
|
(setq-local chronometrist-details-range date))
|
||||||
(`(,begin ,end)
|
(`(,begin ,end)
|
||||||
(setq-local chronometrist-details-range (cons begin end)))
|
(let* ((date-p (seq-find #'chronometrist-iso-date-p input))
|
||||||
|
(begin-date (car (hash-table-keys chronometrist-events)))
|
||||||
|
(begin-iso-ts (ts-format
|
||||||
|
"%FT%T%z" (chronometrist-iso-date-to-ts begin-date)))
|
||||||
|
(end-date (car (last (hash-table-keys chronometrist-events))))
|
||||||
|
(end-iso-ts (chronometrist-format-time-iso8601))
|
||||||
|
(begin (if (equal begin "begin")
|
||||||
|
(if date-p begin-date begin-iso-ts)
|
||||||
|
begin))
|
||||||
|
(end (if (equal end "end")
|
||||||
|
(if date-p end-date end-iso-ts)
|
||||||
|
end)))
|
||||||
|
(setq-local chronometrist-details-range (cons begin end))))
|
||||||
(_ (error "Unsupported range.")))
|
(_ (error "Unsupported range.")))
|
||||||
(tabulated-list-revert)))
|
(tabulated-list-revert)))
|
||||||
|
|
||||||
|
|
|
@ -3416,20 +3416,33 @@ TABLE must be a hash table similar to `chronometrist-events'."
|
||||||
(let ((input (completing-read-multiple
|
(let ((input (completing-read-multiple
|
||||||
(concat "Range (blank, ISO-8601 date, "
|
(concat "Range (blank, ISO-8601 date, "
|
||||||
"or two ISO-8601 dates/timestamps): ")
|
"or two ISO-8601 dates/timestamps): ")
|
||||||
(reverse (hash-table-keys chronometrist-events)) nil nil
|
(append '("begin" "end")
|
||||||
(pcase chronometrist-details-range
|
(reverse (hash-table-keys chronometrist-events)))
|
||||||
('nil nil)
|
nil nil (pcase chronometrist-details-range
|
||||||
((pred stringp)
|
('nil nil)
|
||||||
(format "%s" chronometrist-details-range))
|
((pred stringp)
|
||||||
(`(,begin . ,end)
|
(format "%s" chronometrist-details-range))
|
||||||
(format "%s,%s" begin end)))
|
(`(,begin . ,end)
|
||||||
|
(format "%s,%s" begin end)))
|
||||||
'chronometrist-details-range-history)))
|
'chronometrist-details-range-history)))
|
||||||
(pcase input
|
(pcase input
|
||||||
('nil (setq-local chronometrist-details-range nil))
|
('nil (setq-local chronometrist-details-range nil))
|
||||||
(`(,date)
|
(`(,date)
|
||||||
(setq-local chronometrist-details-range date))
|
(setq-local chronometrist-details-range date))
|
||||||
(`(,begin ,end)
|
(`(,begin ,end)
|
||||||
(setq-local chronometrist-details-range (cons begin end)))
|
(let* ((date-p (seq-find #'chronometrist-iso-date-p input))
|
||||||
|
(begin-date (car (hash-table-keys chronometrist-events)))
|
||||||
|
(begin-iso-ts (ts-format
|
||||||
|
"%FT%T%z" (chronometrist-iso-date-to-ts begin-date)))
|
||||||
|
(end-date (car (last (hash-table-keys chronometrist-events))))
|
||||||
|
(end-iso-ts (chronometrist-format-time-iso8601))
|
||||||
|
(begin (if (equal begin "begin")
|
||||||
|
(if date-p begin-date begin-iso-ts)
|
||||||
|
begin))
|
||||||
|
(end (if (equal end "end")
|
||||||
|
(if date-p end-date end-iso-ts)
|
||||||
|
end)))
|
||||||
|
(setq-local chronometrist-details-range (cons begin end))))
|
||||||
(_ (error "Unsupported range.")))
|
(_ (error "Unsupported range.")))
|
||||||
(tabulated-list-revert)))
|
(tabulated-list-revert)))
|
||||||
|
|
||||||
|
|
Reference in New Issue