summaryrefslogtreecommitdiff
path: root/awk/stats_reviews.awk
diff options
context:
space:
mode:
authorLeon Rische <leon.rische@me.com>2020-04-29 23:18:48 +0200
committerLeon Rische <leon.rische@me.com>2020-05-01 14:13:20 +0200
commit7fd070d98a0425fa9f74fa6fd70074a1dd1fabde (patch)
tree20fe7e5d9bb2ffb90c7198f1cf83844cfcc4f58b /awk/stats_reviews.awk
parentc53af60c891fa06b285e2cbba40b60fcb3419aaf (diff)
Generate S-expressions in review stats script
Diffstat (limited to 'awk/stats_reviews.awk')
-rw-r--r--awk/stats_reviews.awk23
1 files changed, 12 insertions, 11 deletions
diff --git a/awk/stats_reviews.awk b/awk/stats_reviews.awk
index 9716608..1a1d8c5 100644
--- a/awk/stats_reviews.awk
+++ b/awk/stats_reviews.awk
@@ -8,12 +8,7 @@ BEGIN {
{
date = $1;
- file = $2;
- id = $3;
- position = $4;
- ease = $5;
box = $6;
- interval = $7;
rating = $8;
if (box >= min_box) {
@@ -38,17 +33,23 @@ BEGIN {
}
END {
+ print "("
+ print " :all"
report(ratings_all, n_all);
+ print " :month"
report(ratings_month, n_month);
+ print " :week"
report(ratings_week, n_week);
+ print " :day"
report(ratings_day, n_day);
+ print ")"
}
function report(values, n) {
- if (n == 0) {
- print 0 "\t" 0 "\t" 0 "\t" 0 "\t" 0;
- } else {
- print n "\t" values["again"] "\t" values["hard"] "\t" values["good"] "\t" values["easy"] ;
-
- }
+ print " (:total " or_default(n, 0) \
+ " :again " or_default(values["again"], 0) \
+ " :hard " or_default(values["hard"], 0) \
+ " :good " or_default(values["good"], 0) \
+ " :easy " or_default(values["easy"], 0) \
+ ")"
}