summaryrefslogtreecommitdiff
path: root/awk
diff options
context:
space:
mode:
authorLeon Rische <leon.rische@me.com>2020-01-15 12:51:48 +0100
committerLeon Rische <leon.rische@me.com>2020-01-15 12:51:48 +0100
commitbc702165acbc906688b5ad7a94c69d9ac5197b2a (patch)
treec7105401f25e48aae2977f3d0c0f2a6358cd430a /awk
parent00aef827a9b57620561dad5acbce5bd32e59ed6f (diff)
Update readme
Diffstat (limited to 'awk')
-rw-r--r--awk/stats_cards.awk35
-rw-r--r--awk/stats_positions.awk19
-rw-r--r--awk/stats_reviews.awk2
3 files changed, 31 insertions, 25 deletions
diff --git a/awk/stats_cards.awk b/awk/stats_cards.awk
index 3f29338..44cd9b3 100644
--- a/awk/stats_cards.awk
+++ b/awk/stats_cards.awk
@@ -1,7 +1,7 @@
BEGIN {
FS="\t";
total = 0;
- suspended = 0;
+ n_suspended = 0;
t_day = time_days_ago(1);
t_week = time_days_ago(7);
@@ -17,27 +17,28 @@ BEGIN {
type = $3;
by_type[type] += 1;
-
- if ($4 == "1") {
- suspended++;
- }
-
- if ($5 > t_day) {
- created["day"]++;
- }
-
- if ($5 > t_week) {
- created["week"]++;
- }
-
- if ($5 > t_month) {
- created["month"]++;
+ suspended = $4 == "1";
+
+ if (suspended) {
+ n_suspended++;
+ } else {
+ if ($5 > t_day) {
+ created["day"]++;
+ }
+
+ if ($5 > t_week) {
+ created["week"]++;
+ }
+
+ if ($5 > t_month) {
+ created["month"]++;
+ }
}
}
END {
print "total" "\t" total;
- print "suspended" "\t" suspended;
+ print "suspended" "\t" n_suspended;
print "created-day" "\t" created["day"];
print "created-week" "\t" created["week"];
print "created-month" "\t" created["month"];
diff --git a/awk/stats_positions.awk b/awk/stats_positions.awk
index d38d2cd..740ac52 100644
--- a/awk/stats_positions.awk
+++ b/awk/stats_positions.awk
@@ -7,6 +7,7 @@ BEGIN {
box = 0;
due = 0;
now = strftime("%FT%T", systime(), 1);
+ n_stats = 0;
}
{
@@ -15,13 +16,17 @@ BEGIN {
type = $3;
by_type[type] += 1;
- ease += $6;
- box += $7;
- interval += $8;
-
+ # Don't collect ease / box / interval stats for suspended cards
if ($4 == "1") {
suspended += 1;
+ } else {
+ ease += $6;
+ box += $7;
+ interval += $8;
+ n_stats++;
}
+
+
if ($4 == "0" && $9 < now) {
due += 1;
}
@@ -34,7 +39,7 @@ END {
for (var in by_type) {
print "type-" var "\t" by_type[var];
}
- print "avg-ease" "\t" ease / NR;
- print "avg-box" "\t" box / NR;
- print "avg-interval" "\t" interval / NR;
+ print "avg-ease" "\t" ease / n_stats;
+ print "avg-box" "\t" box / n_stats;
+ print "avg-interval" "\t" interval / n_stats;
}
diff --git a/awk/stats_reviews.awk b/awk/stats_reviews.awk
index bacafb2..4dcfa74 100644
--- a/awk/stats_reviews.awk
+++ b/awk/stats_reviews.awk
@@ -1,5 +1,5 @@
BEGIN {
- FS="\t"
+ FS = "\t"
t_day = time_days_ago(1);
t_week = time_days_ago(7);
t_month = time_days_ago(30);