diff options
author | Leon Rische <leon.rische@me.com> | 2020-01-15 12:51:48 +0100 |
---|---|---|
committer | Leon Rische <leon.rische@me.com> | 2020-01-15 12:51:48 +0100 |
commit | bc702165acbc906688b5ad7a94c69d9ac5197b2a (patch) | |
tree | c7105401f25e48aae2977f3d0c0f2a6358cd430a /awk/stats_cards.awk | |
parent | 00aef827a9b57620561dad5acbce5bd32e59ed6f (diff) |
Update readme
Diffstat (limited to 'awk/stats_cards.awk')
-rw-r--r-- | awk/stats_cards.awk | 35 |
1 files changed, 18 insertions, 17 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"]; |