summaryrefslogtreecommitdiffstats
path: root/mkballots.sh
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@zytor.com>2016-11-01 23:04:40 -0600
committerH. Peter Anvin <hpa@zytor.com>2016-11-01 23:04:40 -0600
commit23e7407d241e8e870dd6ddf67f90b04d00d43f3a (patch)
tree56d9232443a30c6ab509d120aca087172801e6df /mkballots.sh
parentbec05220d0d9aa054583acdb204e7eea5cacef42 (diff)
downloadballot-23e7407d241e8e870dd6ddf67f90b04d00d43f3a.tar.gz
ballot-23e7407d241e8e870dd6ddf67f90b04d00d43f3a.tar.xz
ballot-23e7407d241e8e870dd6ddf67f90b04d00d43f3a.zip
Numerous aestetic changes, support multiple batches
1. Insert the unique letters between the prefix and number, that way the ballot number is still easy to spot. Downside is that it no longer sorts lexically, so we need a custom sort routine in csvconv.pl. 2. Include the ballot information on the scoring sheet, so one can make sure they actually agree. 3. Allow generation of multiple batches of numbered ballots, so some can be kept in reserve and not printed in case of overwhelming response.
Diffstat (limited to 'mkballots.sh')
-rwxr-xr-xmkballots.sh19
1 files changed, 14 insertions, 5 deletions
diff --git a/mkballots.sh b/mkballots.sh
index 67f5a40..f15e7d1 100755
--- a/mkballots.sh
+++ b/mkballots.sh
@@ -2,21 +2,30 @@
export PATH=$(realpath -s $(dirname "$0"))/bin:"$PATH"
if [ -z "$1" -o -z "$2" ]; then
set +x
- echo "Usage: $0 prefix numballots" 1>&2
+ echo "Usage: $0 prefix numballots [batches]" 1>&2
exit 1
fi
+nbatch="${3:-1}"
+perbatch="${2:-100}"
+prefix="$1"
+proj="${proj:-tab2016}"
if [ -z "$proj" ]; then
proj=tab2016
fi
sdaps="sdaps $proj"
-ids=$proj/id1.list
rm -rf "$proj"
$sdaps setup_tex "$proj".tex
-genids.pl "$@" > "$ids"
scoresheet.pl "$proj" > "$proj"/scoresheet.tex
cd "$proj"
pdflatex scoresheet.tex ; pdflatex scoresheet.tex
pdfmerge questionnaire.pdf scoresheet.pdf chkalign.pdf
cd ..
-$sdaps stamp -f "$ids"
-
+bdigits=$(echo -n $((nbatch)) | wc -c)
+start=1
+for (( batch=1 ; batch <= nbatch ; batch++ )); do
+ bname=$(printf "%0${bdigits}d" $batch)
+ ids="$proj"/id${bname}.list
+ genids.pl "$prefix" $perbatch $start $((nbatch*perbatch)) > "$ids"
+ $sdaps stamp -f "$ids" -o "$proj"/ballots_${bname}.pdf
+ start=$((start + perbatch))
+done