summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLeon <gh@leonrische.me>2020-02-25 14:49:11 +0100
committerGitHub <noreply@github.com>2020-02-25 14:49:11 +0100
commit7a2b9cda20d472d3e3fb57cb45ff0e681728cdec (patch)
treeea78c50284ccefad69d5fe3e9dbfa447035d7460
parent7b7bf9b00eec47f3b0583e0e76bd38715cc59699 (diff)
parent07556b9ebfea6db35140bbfe5037a8573d991f91 (diff)
Merge pull request #11 from l3kn/configurable-box-limit
Add configurable box-limit for review statistics
-rw-r--r--README.org6
-rw-r--r--awk/stats_reviews.awk3
-rw-r--r--awk/utils.awk2
-rw-r--r--org-fc-awk.el3
-rw-r--r--org-fc.el5
5 files changed, 16 insertions, 3 deletions
diff --git a/README.org b/README.org
index 5d388d4..097ca5c 100644
--- a/README.org
+++ b/README.org
@@ -237,6 +237,12 @@ and cards / card types.
[[file:images/stats.png]]
+Only cards with a box >= ~org-fc-stats-review-min-box~ (default: 0)
+are included in the review statistics.
+
+Setting this to a higher value (e.g. 2) excludes the first few
+"learning" reviews of a card.
+
See also:
- [[file:doc/review_history.org][Review History]]
diff --git a/awk/stats_reviews.awk b/awk/stats_reviews.awk
index eb5605a..9716608 100644
--- a/awk/stats_reviews.awk
+++ b/awk/stats_reviews.awk
@@ -3,6 +3,7 @@ BEGIN {
t_day = time_days_ago(1);
t_week = time_days_ago(7);
t_month = time_days_ago(30);
+ min_box = or_default(min_box, 0);
}
{
@@ -15,7 +16,7 @@ BEGIN {
interval = $7;
rating = $8;
- if (box >= 2) {
+ if (box >= min_box) {
if (date > t_day) {
ratings_day[rating]++;
n_day++;
diff --git a/awk/utils.awk b/awk/utils.awk
index 159f9b7..01295a2 100644
--- a/awk/utils.awk
+++ b/awk/utils.awk
@@ -19,5 +19,5 @@ function time_days_ago(n) {
}
function or_default(var, def) {
- return var ? var : def;
+ return (var != "") ? var : def;
}
diff --git a/org-fc-awk.el b/org-fc-awk.el
index d9f19cd..2f98c54 100644
--- a/org-fc-awk.el
+++ b/org-fc-awk.el
@@ -221,7 +221,8 @@ Return nil there is no history file."
(org-fc-awk--command
"awk/stats_reviews.awk"
:utils t
- :input org-fc-review-history-file)))))
+ :input org-fc-review-history-file
+ :variables `(("min_box" . ,org-fc-stats-review-min-box)))))))
`(:all ,(first res) :month ,(second res) :week ,(third res) :day ,(fourth res)))))
;;;; Footer
diff --git a/org-fc.el b/org-fc.el
index a2c5e57..94a1a34 100644
--- a/org-fc.el
+++ b/org-fc.el
@@ -87,6 +87,11 @@
:type 'list
:group 'org-fc)
+(defcustom org-fc-stats-review-min-box 0
+ "Minimum box for reviews to include in the review stats."
+ :type 'integer
+ :group 'org-fc)
+
;; TODO: Allow customizing this, currently that's not possible because
;; the indexers / filters expect a ISO8601 format.
(defvar org-fc-timestamp-format "%FT%TZ"