summaryrefslogtreecommitdiff
path: root/org-fc-dashboard.el
diff options
context:
space:
mode:
authorLeon Rische <leon.rische@me.com>2020-01-27 14:54:20 +0100
committerLeon Rische <leon.rische@me.com>2020-01-27 14:54:20 +0100
commit44ebeb88c5e63d6ed85c7240d72122f073b3a232 (patch)
treeb696d2c5800aa4355898f9bcac984d9078b30bd0 /org-fc-dashboard.el
parent329db3c55a87be86ff2afdee0420a886d1dd2e4d (diff)
Load review data for review hydra
Diffstat (limited to 'org-fc-dashboard.el')
-rw-r--r--org-fc-dashboard.el24
1 files changed, 13 insertions, 11 deletions
diff --git a/org-fc-dashboard.el b/org-fc-dashboard.el
index 936e4ea..d1f27de 100644
--- a/org-fc-dashboard.el
+++ b/org-fc-dashboard.el
@@ -42,11 +42,12 @@
"Generate a svg bar-chart for the plist STAT"
(let* ((width org-fc-dashboard-bar-chart-width)
(height org-fc-dashboard-bar-chart-height)
+ (total (plist-get stat :total))
(values
- `((,(or (plist-get stat :again) 0.0) . "red")
- (,(or (plist-get stat :hard) 0.0) . "yellow")
- (,(or (plist-get stat :good) 0.0) . "green")
- (,(or (plist-get stat :easy) 0.0) . "darkgreen")))
+ `((,(/ (plist-get stat :again) total) . "red")
+ (,(/ (plist-get stat :hard) total) . "yellow")
+ (,(/ (plist-get stat :good) total) . "green")
+ (,(/ (plist-get stat :easy) total) . "darkgreen")))
(svg (svg-create width height)))
(do ((values values (cdr values))
(pos 0 (+ pos (* width (caar values)))))
@@ -55,11 +56,12 @@
(svg-image svg)))
(defun org-fc-dashboard-percent-right (stats)
- (format " %5.2f | %5.2f | %5.2f | %5.2f"
- (or (* 100 (plist-get stats :again)) 0.0)
- (or (* 100 (plist-get stats :hard)) 0.0)
- (or (* 100 (plist-get stats :good)) 0.0)
- (or (* 100 (plist-get stats :easy)) 0.0)))
+ (let ((total (plist-get stats :total)))
+ (format " %5.2f | %5.2f | %5.2f | %5.2f"
+ (or (* 100 (/ (plist-get stats :again) total)) 0.0)
+ (or (* 100 (/ (plist-get stats :hard) total)) 0.0)
+ (or (* 100 (/ (plist-get stats :good) total)) 0.0)
+ (or (* 100 (/ (plist-get stats :easy) total)) 0.0))))
;;; Main View
@@ -121,8 +123,8 @@
(:month . "Month")
(:all . "All")))
(when-let (stat (plist-get reviews-stats (car scope)))
- (when (plusp (plist-get stat :reviews))
- (insert (propertize (format " %s (%d)\n" (cdr scope) (plist-get stat :reviews)) 'face 'org-level-1))
+ (when (plusp (plist-get stat :total))
+ (insert (propertize (format " %s (%d)\n" (cdr scope) (plist-get stat :total)) 'face 'org-level-1))
(insert " ")
(insert-image (org-fc-dashboard-bar-chart stat))
(insert (org-fc-dashboard-percent-right stat))