Update more call sites and method signatures
This commit is contained in:
parent
ffe615c1e8
commit
6c96cc4e57
|
@ -56,7 +56,7 @@ STREAM (which is the value of `current-buffer')."
|
||||||
(cl-defmethod chronometrist-backend-from-hash ((backend chronometrist-sexp) table))
|
(cl-defmethod chronometrist-backend-from-hash ((backend chronometrist-sexp) table))
|
||||||
|
|
||||||
;; # Queries #
|
;; # Queries #
|
||||||
(cl-defmethod chronometrist-backend-open-file ((backend chronometrist-sexp) file)
|
(cl-defmethod chronometrist-backend-open-file ((backend chronometrist-sexp))
|
||||||
(find-file-other-window (chronometrist-file-path))
|
(find-file-other-window (chronometrist-file-path))
|
||||||
(goto-char (point-max)))
|
(goto-char (point-max)))
|
||||||
|
|
||||||
|
@ -143,7 +143,7 @@ The data is obtained from `chronometrist-file', via `chronometrist-events'.
|
||||||
TS should be a ts struct (see `ts.el').
|
TS should be a ts struct (see `ts.el').
|
||||||
|
|
||||||
The return value is seconds, as an integer."
|
The return value is seconds, as an integer."
|
||||||
(let ((task-events (chronometrist-backend-task-intervals task ts)))
|
(let ((task-events (chronometrist-backend-task-intervals chronometrist-backend-current task ts)))
|
||||||
(if task-events
|
(if task-events
|
||||||
(->> (chronometrist-events->ts-pairs task-events)
|
(->> (chronometrist-events->ts-pairs task-events)
|
||||||
(chronometrist-ts-pairs->durations)
|
(chronometrist-ts-pairs->durations)
|
||||||
|
|
|
@ -39,15 +39,17 @@
|
||||||
(emacsql db [:insert-into events [$i1] :values $v2]
|
(emacsql db [:insert-into events [$i1] :values $v2]
|
||||||
(vconcat columns) (vconcat values))))
|
(vconcat columns) (vconcat values))))
|
||||||
|
|
||||||
(cl-defmethod chronometrist-backend-from-hash ((backend chronometrist-sqlite3) file)
|
(cl-defmethod chronometrist-backend-from-hash ((backend chronometrist-sqlite3) hash-table file)
|
||||||
|
"Save HASH-TABLE as a FILE of BACKEND.
|
||||||
|
FILE should be a file path without an extension."
|
||||||
(cl-loop with db = (emacsql-sqlite3 (concat file "." (oref backend :ext)))
|
(cl-loop with db = (emacsql-sqlite3 (concat file "." (oref backend :ext)))
|
||||||
with count = 0
|
with count = 0
|
||||||
for events being the hash-values of table do
|
for events being the hash-values of hash-table do
|
||||||
(cl-loop for event in events do
|
(cl-loop for event in events do
|
||||||
(chronometrist-sqlite3-insert-plist event db)
|
(chronometrist-sqlite3-insert-plist event db)
|
||||||
(incf count)
|
(incf count)
|
||||||
(when (zerop (% count 5))
|
(when (zerop (% count 5))
|
||||||
(message "chronometrist-migrate-migrate - %s events converted" count)))
|
(message "chronometrist-migrate - %s events converted" count)))
|
||||||
finally return count do
|
finally return count do
|
||||||
(message "chronometrist-migrate - finished converting %s events." count)))
|
(message "chronometrist-migrate - finished converting %s events." count)))
|
||||||
|
|
||||||
|
@ -64,14 +66,14 @@
|
||||||
|
|
||||||
(cl-defmethod chronometrist-backend-current-task ((backend chronometrist-sqlite3)))
|
(cl-defmethod chronometrist-backend-current-task ((backend chronometrist-sqlite3)))
|
||||||
|
|
||||||
(cl-defmethod chronometrist-backend-intervals (task &optional (ts (ts-now)))
|
(cl-defmethod chronometrist-backend-intervals ((backend chronometrist-sqlite3) task &optional (ts (ts-now)))
|
||||||
"Return the time intervals for TASK on TS.")
|
"Return the time intervals for TASK on TS.")
|
||||||
|
|
||||||
(cl-defmethod chronometrist-backend-task-time (task &optional (ts (ts-now))))
|
(cl-defmethod chronometrist-backend-task-time ((backend chronometrist-sqlite3) task &optional (ts (ts-now))))
|
||||||
|
|
||||||
(cl-defmethod chronometrist-backend-active-time (&optional ts))
|
(cl-defmethod chronometrist-backend-active-time ((backend chronometrist-sqlite3) &optional ts))
|
||||||
|
|
||||||
(cl-defmethod chronometrist-backend-active-days (task))
|
(cl-defmethod chronometrist-backend-active-days ((backend chronometrist-sqlite3) task))
|
||||||
|
|
||||||
;; # Modifications #
|
;; # Modifications #
|
||||||
(cl-defmethod chronometrist-backend-create-file ((backend chronometrist-sqlite3))
|
(cl-defmethod chronometrist-backend-create-file ((backend chronometrist-sqlite3))
|
||||||
|
|
|
@ -100,7 +100,7 @@ TABLE should be a hash table - if not supplied,
|
||||||
(let ((days 0)
|
(let ((days 0)
|
||||||
(per-day-time-list))
|
(per-day-time-list))
|
||||||
(maphash (lambda (key _value)
|
(maphash (lambda (key _value)
|
||||||
(let ((events-in-day (chronometrist-backend-task-intervals task (chronometrist-iso-date->ts key))))
|
(let ((events-in-day (chronometrist-backend-task-intervals chronometrist-backend-current task (chronometrist-iso-date->ts key))))
|
||||||
(when events-in-day
|
(when events-in-day
|
||||||
(setq days (1+ days))
|
(setq days (1+ days))
|
||||||
(->> (chronometrist-events->ts-pairs events-in-day)
|
(->> (chronometrist-events->ts-pairs events-in-day)
|
||||||
|
|
Reference in New Issue