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
|
||||
*** statistics
|
||||
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]
|
||||
+ [-] commands [50%]
|
||||
1. [X] set [task/key-value] filter [fn:2]
|
||||
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
|
||||
4. [ ] set duration format
|
||||
+ [ ] with =spark= - vertical sparkline for each interval
|
||||
+ [ ] 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
|
||||
*** task-key-values
|
||||
|
|
|
@ -2161,20 +2161,33 @@ TABLE must be a hash table similar to `chronometrist-events'."
|
|||
(let ((input (completing-read-multiple
|
||||
(concat "Range (blank, ISO-8601 date, "
|
||||
"or two ISO-8601 dates/timestamps): ")
|
||||
(reverse (hash-table-keys chronometrist-events)) nil nil
|
||||
(pcase chronometrist-details-range
|
||||
('nil nil)
|
||||
((pred stringp)
|
||||
(format "%s" chronometrist-details-range))
|
||||
(`(,begin . ,end)
|
||||
(format "%s,%s" begin end)))
|
||||
(append '("begin" "end")
|
||||
(reverse (hash-table-keys chronometrist-events)))
|
||||
nil nil (pcase chronometrist-details-range
|
||||
('nil nil)
|
||||
((pred stringp)
|
||||
(format "%s" chronometrist-details-range))
|
||||
(`(,begin . ,end)
|
||||
(format "%s,%s" begin end)))
|
||||
'chronometrist-details-range-history)))
|
||||
(pcase input
|
||||
('nil (setq-local chronometrist-details-range nil))
|
||||
(`(,date)
|
||||
(setq-local chronometrist-details-range date))
|
||||
(`(,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.")))
|
||||
(tabulated-list-revert)))
|
||||
|
||||
|
|
|
@ -3416,20 +3416,33 @@ TABLE must be a hash table similar to `chronometrist-events'."
|
|||
(let ((input (completing-read-multiple
|
||||
(concat "Range (blank, ISO-8601 date, "
|
||||
"or two ISO-8601 dates/timestamps): ")
|
||||
(reverse (hash-table-keys chronometrist-events)) nil nil
|
||||
(pcase chronometrist-details-range
|
||||
('nil nil)
|
||||
((pred stringp)
|
||||
(format "%s" chronometrist-details-range))
|
||||
(`(,begin . ,end)
|
||||
(format "%s,%s" begin end)))
|
||||
(append '("begin" "end")
|
||||
(reverse (hash-table-keys chronometrist-events)))
|
||||
nil nil (pcase chronometrist-details-range
|
||||
('nil nil)
|
||||
((pred stringp)
|
||||
(format "%s" chronometrist-details-range))
|
||||
(`(,begin . ,end)
|
||||
(format "%s,%s" begin end)))
|
||||
'chronometrist-details-range-history)))
|
||||
(pcase input
|
||||
('nil (setq-local chronometrist-details-range nil))
|
||||
(`(,date)
|
||||
(setq-local chronometrist-details-range date))
|
||||
(`(,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.")))
|
||||
(tabulated-list-revert)))
|
||||
|
||||
|
|
Reference in New Issue