diff options
author | Leon Rische <leon.rische@me.com> | 2020-02-25 14:47:30 +0100 |
---|---|---|
committer | Leon Rische <leon.rische@me.com> | 2020-02-25 14:47:30 +0100 |
commit | 07556b9ebfea6db35140bbfe5037a8573d991f91 (patch) | |
tree | ea78c50284ccefad69d5fe3e9dbfa447035d7460 /awk | |
parent | 7b7bf9b00eec47f3b0583e0e76bd38715cc59699 (diff) |
Add configurable box-limit for review statistics
Diffstat (limited to 'awk')
-rw-r--r-- | awk/stats_reviews.awk | 3 | ||||
-rw-r--r-- | awk/utils.awk | 2 |
2 files changed, 3 insertions, 2 deletions
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; } |