from gittip import db
^L

nusers = db.fetchone("SELECT count(*) AS n FROM participants WHERE claimed_time IS NOT NULL")['n']
ncc = db.fetchone("SELECT count(*) AS n FROM participants WHERE last_bill_result = ''")['n']
statements = list(db.fetchall("SELECT id, statement FROM participants WHERE statement != '' ORDER BY id"))
amount = db.fetchone("SELECT transfer_volume AS v FROM paydays ORDER BY ts_end DESC LIMIT 1")['v']

def part(s):
    s = s.splitlines()[0]
    if len(s) > 60:
        s = s[:57].rsplit(None, 1)[0] + " ..."
    return s

^L
{% extends templates/base.html %}
{% block body %}

<h2><b>{{ nusers }}</b> users have <b>claimed</b> their account.</h2>

<h2><b>{{ ncc }}</b> users have a working <b>credit card</b> on file.</h2>

<h2><b>${{ amount }} changed hands</b> last Friday.</h2>

<h2><b>{{ len(statements) }}</b> users are <b>making the world better</b>.</h2>
{% for statement in statements %}
<p><b><a href="/{{ statement['id'] }}/">{{ escape(statement['id']) }}</a></b> 
&mdash;{{ escape(part(statement['statement'])) }}</p>{% end %}

{% end %}

from gittip import db
^L

npeople = db.fetchone("SELECT count(*) AS n FROM participants WHERE claimed_time IS NOT NULL")['n']
ncc = db.fetchone("SELECT count(*) AS n FROM participants WHERE last_bill_result = ''")['n']
statements = list(db.fetchall("SELECT id, statement FROM participants WHERE statement != '' ORDER BY id"))
amount = db.fetchone("SELECT transfer_volume AS v FROM paydays ORDER BY ts_end DESC LIMIT 1")['v']

def part(s):
    s = s.splitlines()[0]
    if len(s) > 60:
        s = s[:57].rsplit(None, 1)[0] + " ..."
    return s

^L
{% extends templates/base.html %}
{% block body %}

<h2><b>{{ npeople }}</b> people have <b>claimed</b> their account.</h2>

<h2><b>{{ ncc }}</b> people have a working <b>credit card</b> on file.</h2>

<h2><b>${{ amount }} changed hands</b> last Friday.</h2>

<h2><b>{{ len(statements) }}</b> people are <b>making the world better</b>.</h2>

<p>
{% for statement in statements %}
<b><a href="/{{ statement['id'] }}/">{{ escape(statement['id']) }}</a></b> 
&mdash;{{ escape(part(statement['statement'])) }}</b><br />{% end %}
</p>

{% end %}

Tweak the new stats page
Tweak the new stats page

With apologies to @stats (Daniel Curran).
