diff options
author | Leon Rische <leon.rische@me.com> | 2020-01-30 15:12:29 +0100 |
---|---|---|
committer | Leon Rische <leon.rische@me.com> | 2020-01-30 15:12:29 +0100 |
commit | 52e6f88e59397e8b0de0255de1e6cc375356e5e9 (patch) | |
tree | 11a74b409f48b0c11953bd17fd63378449a39412 /org-fc-review.el | |
parent | 822c3dac9b0def491f7de712bb2298e64a5f5ec2 (diff) |
Track time per card in review stats
Diffstat (limited to 'org-fc-review.el')
-rw-r--r-- | org-fc-review.el | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/org-fc-review.el b/org-fc-review.el index f914c97..3674d73 100644 --- a/org-fc-review.el +++ b/org-fc-review.el @@ -119,7 +119,9 @@ (path (plist-get card :path)) (id (plist-get card :id)) (type (plist-get card :type)) - (position (plist-get card :position))) + (position (plist-get card :position)) + ;; Prevent messages from hiding the multiple-choice card dialog + (inhibit-message t)) (let ((buffer (find-buffer-visiting path))) (with-current-buffer (find-file path) ;; If buffer was already open, don't kill it after rating the card @@ -134,6 +136,7 @@ (org-fc-narrow-tree) (org-fc-hide-drawers) (org-fc-show-latex) + (setq org-fc-timestamp (time-to-seconds (current-time))) (funcall (org-fc-type-setup-fn type) position)))) (progn (message "Review Done") @@ -188,18 +191,20 @@ a review session." card of the review session." (interactive) (org-fc-review-with-current-item card - (let ((path (plist-get card :path)) - (id (plist-get card :id)) - (position (plist-get card :position))) + (let* ((path (plist-get card :path)) + (id (plist-get card :id)) + (position (plist-get card :position)) + (now (time-to-seconds (current-time))) + (delta (- now org-fc-timestamp))) (org-fc-session-add-rating org-fc-review--current-session rating) - (org-fc-review-update-data path id position rating) + (org-fc-review-update-data path id position rating delta) (save-buffer) ;; TODO: Conditional kill (unless org-fc-reviewing-existing-buffer (kill-buffer)) (org-fc-review-next-card)))) -(defun org-fc-review-update-data (path id position rating) +(defun org-fc-review-update-data (path id position rating delta) (save-excursion (org-fc-goto-entry-heading) (let* ((data (org-fc-get-review-data)) @@ -218,7 +223,8 @@ a review session." (format "%.2f" ease) (format "%d" box) (format "%.2f" interval) - (symbol-name rating))) + (symbol-name rating) + (format "%.2f" delta))) (destructuring-bind (next-ease next-box next-interval) (org-fc-sm2-next-parameters ease box interval rating) (setcdr |