blob: 1a1d8c5a3b4749146925047e2a27831d7f2b85a6 (
about) (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
|
BEGIN {
FS = "\t"
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);
}
{
date = $1;
box = $6;
rating = $8;
if (box >= min_box) {
if (date > t_day) {
ratings_day[rating]++;
n_day++;
}
if (date > t_week) {
ratings_week[rating]++;
n_week++;
}
if (date > t_month) {
ratings_month[rating]++;
n_month++;
}
ratings_all[rating]++;
n_all++;
}
}
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) {
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) \
")"
}
|