#!/bin/sh
. config.sh
echo 'content-type: text/html'
echo
$PSQL -q -T border -H tron << !
    \C "Scores for $QUERY_STRING"
    select won+tied+lost as games,
	won,tied,lost,
	dtrunc(0.49+100*float8(won)/float8(won+tied+lost))/100 as rate,
	won - lost as points
	from allhumans 
	where username='$QUERY_STRING';
!
