Protocol - move list-records; remove task-time

task-time does not need to be polymorphic
This commit is contained in:
contrapunctus 2021-09-07 07:20:12 +05:30
parent 648253172a
commit b1192b1fdf
2 changed files with 8 additions and 23 deletions

View File

@ -383,12 +383,12 @@ Value must be a keyword corresponding to a key in
(cl-defgeneric chronometrist-list-tasks (backend &key start end)
"Return a list of tasks from BACKEND.")
(cl-defgeneric chronometrist-list-records (backend)
"Return all records in BACKEND as a list of plists, in reverse chronological order.")
(cl-defgeneric chronometrist-task-records (backend task date)
"From BACKEND, return records for TASK on DATE as a list of plists.")
(cl-defgeneric chronometrist-task-time (backend task date)
"From BACKEND, return time recorded for TASK on DATE as integer seconds.")
(cl-defgeneric chronometrist-active-time (backend date)
"From BACKEND, return total time recorded on DATE as integer seconds.")
@ -425,9 +425,6 @@ Hash table keys are ISO-8601 date strings. Hash table values are
lists of records, represented by plists. Both hash table keys and
hash table values must be in chronological order.")
(cl-defgeneric chronometrist-list-records (backend)
"Return all records in BACKEND as a list of plists, in reverse chronological order.")
(cl-defgeneric chronometrist-on-file-change (backend)
"Function to be run when file for BACKEND changes.")
@ -721,8 +718,6 @@ Return
when (equal task (plist-get plist :name))
collect plist))))
(cl-defmethod chronometrist-task-time ((backend chronometrist-plist-group-backend) task date))
(cl-defmethod chronometrist-active-time ((backend chronometrist-plist-group-backend) date))
(cl-defmethod chronometrist-active-days ((backend chronometrist-plist-group-backend) task &key start end))

View File

@ -962,18 +962,17 @@ Value must be a keyword corresponding to a key in
"Return a list of tasks from BACKEND.")
#+END_SRC
**** list-records :generic:function:
#+BEGIN_SRC emacs-lisp
(cl-defgeneric chronometrist-list-records (backend)
"Return all records in BACKEND as a list of plists, in reverse chronological order.")
#+END_SRC
**** task-records :generic:function:
#+BEGIN_SRC emacs-lisp
(cl-defgeneric chronometrist-task-records (backend task date)
"From BACKEND, return records for TASK on DATE as a list of plists.")
#+END_SRC
**** task-time :generic:function:
#+BEGIN_SRC emacs-lisp
(cl-defgeneric chronometrist-task-time (backend task date)
"From BACKEND, return time recorded for TASK on DATE as integer seconds.")
#+END_SRC
**** active-time :generic:function:
#+BEGIN_SRC emacs-lisp
(cl-defgeneric chronometrist-active-time (backend date)
@ -1040,11 +1039,6 @@ lists of records, represented by plists. Both hash table keys and
hash table values must be in chronological order.")
#+END_SRC
**** list-records :generic:function:
#+BEGIN_SRC emacs-lisp
(cl-defgeneric chronometrist-list-records (backend)
"Return all records in BACKEND as a list of plists, in reverse chronological order.")
#+END_SRC
**** on-file-change :generic:function:
#+BEGIN_SRC emacs-lisp
(cl-defgeneric chronometrist-on-file-change (backend)
@ -1603,10 +1597,6 @@ This is largely like the plist backend, but plists are grouped by date. This mak
collect plist))))
#+END_SRC
**** task-time :reader:method:
#+BEGIN_SRC emacs-lisp
(cl-defmethod chronometrist-task-time ((backend chronometrist-plist-group-backend) task date))
#+END_SRC
**** active-time :reader:method:
#+BEGIN_SRC emacs-lisp
(cl-defmethod chronometrist-active-time ((backend chronometrist-plist-group-backend) date))