-
Notifications
You must be signed in to change notification settings - Fork 0
/
author_stats
executable file
·47 lines (40 loc) · 1.35 KB
/
author_stats
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
#!/bin/sh -e
# This script draws a plot to compare mailing list activities
# set -x
if [ "$1" = "" ] ; then
echo "Usage: `basename $0` <listname> [numauthors] [outputformat] [textcolor]"
exit 1
fi
NUM=10
if [ $# -gt 1 ] ; then
if [ "$2" -lt $NUM -o "$2" -gt $NUM ] ; then
NUM=$2
fi
fi
LIST_NAME=$1
TOTAL_AUTHORS=`psql -t teammetrics -c "SELECT COUNT(DISTINCT name) FROM listarchives WHERE project = '$LIST_NAME'"`;
if [ $TOTAL_AUTHORS -lt $NUM ] ; then
NUM=$TOTAL_AUTHORS
fi
NAME=authorstat_"$1"
DATFILE="${NAME}_year.txt"
#QUERYFILE=`mktemp`
# psql -t listarchives -c "SELECT BuildQueryAuthorsYear('$1', $NUM) ;" | sed '1s/\( CAST(SUM([^)]\+) AS int) AS "[^"]\+[ _]\w\)[^ ^_]\+"/\1."/g' > $QUERYFILE
#cat $QUERYFILE | \
# psql listarchives \
# >"$DATFILE"
#rm $QUERYFILE
#
#sed -i -e '/^[-+]\+$/d' -e '/^([0-9]\+ [A-Za-z]\+)$/d' \
# -e 's/[[:space:]]*|[[:space:]]*/\t/g' \
# "$DATFILE"
./author_stats_helper.py list $1 > $DATFILE
## -e 's/®//g' -e 's/é/e/' \
## -e 's/á/á/g' -e 's/ñ/ñ/' \
## -e 's/è/è/g' -e 's/ö/ö/g' \
if [ "$3" = "pdf" ] ; then
# PDFs are usually used in slides where we add the headline in LaTeX
./author_stats_create_graph $DATFILE $NUM "" "$3" "$4"
else
./author_stats_create_graph $DATFILE $NUM "List activities for $1 list" "$3" "$4"
fi