From 1ca35ff6e5d1de3cfefd6bf02c438a457e2f6fc8 Mon Sep 17 00:00:00 2001 From: Leon Rische Date: Sun, 2 Feb 2020 20:08:21 +0100 Subject: Check if review history file exists before loading it --- org-fc-dashboard.el | 32 +++++++++++++++++--------------- 1 file changed, 17 insertions(+), 15 deletions(-) (limited to 'org-fc-dashboard.el') diff --git a/org-fc-dashboard.el b/org-fc-dashboard.el index 7f9357c..97dab2e 100644 --- a/org-fc-dashboard.el +++ b/org-fc-dashboard.el @@ -117,22 +117,24 @@ (insert "\n") - (insert - (propertize " Review Statistics\n\n" 'face 'org-level-1)) - - (dolist (scope '((:day . "Day") - (:week . "Week") - (:month . "Month") - (:all . "All"))) - (when-let (stat (plist-get reviews-stats (car scope))) - (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)) - (insert "\n\n")))) + (when reviews-stats + (insert + (propertize " Review Statistics\n\n" 'face 'org-level-1)) + + (dolist (scope '((:day . "Day") + (:week . "Week") + (:month . "Month") + (:all . "All"))) + (when-let (stat (plist-get reviews-stats (car scope))) + (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)) + (insert "\n\n")))) + + (insert "\n")) - (insert "\n") (insert (propertize " [r] Review\n" 'face 'org-level-1)) (insert -- cgit v1.2.3