mirror of
https://github.com/kennethreitz-archive/www.gittip.com.git
synced 2026-06-21 07:40:58 +00:00
3808ea6152
We got a nice pull request from @jofusa, which adds our first view to the schema. It, however, leads to division by zero and had another niggle or two. This cleans it up.
60 lines
1.4 KiB
HTML
60 lines
1.4 KiB
HTML
import locale
|
|
|
|
from gittip import db
|
|
|
|
# ==== ^L
|
|
|
|
ngoals = db.fetchone("SELECT count(id) FROM participants WHERE goal > 0")\
|
|
['count']
|
|
goals = db.fetchall("""
|
|
|
|
SELECT *
|
|
FROM goal_summary
|
|
ORDER BY percentage DESC
|
|
, goal ASC
|
|
, id ASC
|
|
|
|
""")
|
|
|
|
# ==== ^L
|
|
{% extends templates/base.html %}
|
|
{% block page %}
|
|
<p class="below-header"><a href="./">About</a></p>
|
|
<style>
|
|
TH, TD {
|
|
padding-right: 1em;
|
|
}
|
|
.statement {
|
|
text-align: left;
|
|
font-size: 9pt;
|
|
line-height: 11pt;
|
|
padding-bottom: 1em;
|
|
}
|
|
.statement DIV {
|
|
overflow: hidden;
|
|
white-space: nowrap;
|
|
width: 600px;
|
|
}
|
|
</style>
|
|
|
|
<h2>{{ ngoals }} people have set a weekly funding goal.</h2>
|
|
<table>
|
|
<tr>
|
|
<th>Participant</th>
|
|
<th style="text-align: right;">Goal ($)</a></th>
|
|
<th colspan="2" style="text-align: right;">Backed ($, %)</a></th>
|
|
</tr>
|
|
{% for row in goals %}
|
|
<tr>
|
|
<th><a href="/{{ row['id'] }}/">{{ row['id'] }}</a></th>
|
|
<td>{{ locale.format("%.2f", row['goal'], grouping=True) }}</td>
|
|
<td>{{ locale.format("%.2f", row['amount'], grouping=True) }}</td>
|
|
<td>{{ "%5.1f" % row['percentage'] }}</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="statement" colspan="4"><div>{{ escape(row['statement']) }}</div></td>
|
|
</tr>
|
|
{% end %}
|
|
</table>
|
|
{% end %}
|