This repository has been archived by the owner on Feb 8, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 308
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
We talked about a few ways to make the homepage dynamic. The leaderboard exists and is low-hanging fruit for this.
- Loading branch information
1 parent
1f34170
commit a545c25
Showing
6 changed files
with
135 additions
and
190 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,142 +1,3 @@ | ||
from gittip import db | ||
^L | ||
|
||
receivers = db.fetchall(""" | ||
|
||
SELECT tippee, claimed_time, sum(amount) AS amount | ||
FROM ( SELECT DISTINCT ON (tipper, tippee) | ||
amount | ||
, tippee | ||
FROM tips | ||
JOIN participants p ON p.id = tipper | ||
JOIN social_network_users snu ON snu.participant_id = tippee | ||
WHERE last_bill_result = '' | ||
AND snu.is_locked = false | ||
ORDER BY tipper, tippee, mtime DESC | ||
) AS foo | ||
JOIN participants p ON p.id = tippee | ||
GROUP BY tippee, claimed_time | ||
ORDER BY amount DESC | ||
LIMIT 10 | ||
|
||
""") | ||
|
||
givers = db.fetchall(""" | ||
|
||
SELECT tipper, shares_giving, sum(amount) AS amount | ||
FROM ( SELECT DISTINCT ON (tipper, tippee) | ||
amount | ||
, tipper | ||
FROM tips | ||
JOIN participants p ON p.id = tipper | ||
JOIN social_network_users snu ON snu.participant_id = tippee | ||
WHERE last_bill_result = '' | ||
AND snu.is_locked = false | ||
ORDER BY tipper, tippee, mtime DESC | ||
) AS foo | ||
JOIN participants p ON p.id = tipper | ||
GROUP BY tipper, shares_giving | ||
ORDER BY amount DESC | ||
LIMIT 10 | ||
|
||
""") | ||
|
||
request.redirect('/') | ||
^L | ||
{% extends templates/base.html %} | ||
{% block body %} | ||
<style> | ||
TABLE { | ||
font: 300 13pt/13pt Lato, sans-serif; | ||
} | ||
TD { | ||
text-align: left; | ||
vertical-align: top; | ||
padding: 6pt 12pt 6pt 0; | ||
} | ||
TD.amount { | ||
text-align: right; | ||
} | ||
TR.unclaimed, | ||
TR.unclaimed A { | ||
color: #B2A196; | ||
} | ||
TR.unclaimed TD SPAN { | ||
font-size: 10pt; | ||
} | ||
#givers { | ||
float: left; | ||
} | ||
#receivers { | ||
float: right; | ||
} | ||
H2.clear { | ||
padding-top: 36pt; | ||
} | ||
H3 { | ||
margin-top: 12pt; | ||
} | ||
</style> | ||
|
||
<p class="below-header"><a href="./">About</a></p> | ||
|
||
<h2>Leaderboard | ||
<span class="small"><a href="unclaimed.html">Unclaimed</a></span> | ||
</h2> | ||
|
||
<div id="givers"> | ||
|
||
<h3 class="first">Top Givers</h3> | ||
|
||
<table> | ||
{% for i, giver in enumerate(givers, start=1) %} | ||
<tr> | ||
<td>{{ i }}.</td> | ||
<td class="amount">$</td> | ||
<td class="amount">{{ giver['amount'] }}</td> | ||
{% if giver['shares_giving'] %} | ||
<td><a href="/{{ giver['tipper'] }}/">{{ giver['tipper'] }}</a></td> | ||
{% else %} | ||
<td class="unclaimed">anonymous</td> | ||
{% end %} | ||
</tr> | ||
{% end %} | ||
</table> | ||
|
||
</div> | ||
|
||
<div id="receivers"> | ||
|
||
<h3 class="first">Top Receivers</h3> | ||
|
||
<table> | ||
{% for i, receiver in enumerate(receivers, start=1) %} | ||
<tr{% if receiver['claimed_time'] is None %} class="unclaimed"{% end %}> | ||
<td>{{ i }}.</td> | ||
<td class="amount">$</td> | ||
<td class="amount">{{ receiver['amount'] }}</td> | ||
<td><a href="/{{ receiver['tippee'] }}/">{{ receiver['tippee'] }}</a> | ||
{% if receiver['claimed_time'] is None %}<br /><span class="small help">unclaimed!</span>{% end %} | ||
</td> | ||
</tr> | ||
{% end %} | ||
</table> | ||
|
||
</div> | ||
|
||
|
||
<h2 class="clear">Gittip happens every Friday.</h2> | ||
|
||
<p>The amounts above are what the Gittip community is willing to give as | ||
a weekly gift to each person, but only if the person accepts it. Gittip is | ||
<b>opt-in</b>. We never collect money on a person’s behalf until that | ||
person opts in by claiming their account.</p> | ||
|
||
<p class="help">Amounts are based on tips from people with a | ||
{% if user.ANON %}working credit card{% else %}<a href="/credit-card.html">working | ||
credit card</a>{% end %} on file. If a card stops working this week | ||
then the actual amount distributed can be lower. If someone doesn’t | ||
have a working card but does have a positive Gittip balance themselves then | ||
the actual amount distributed can be higher. Make sense?</p> | ||
|
||
|
||
{% end %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -92,7 +92,7 @@ BLOCKQUOTE { | |
|
||
#you-are { | ||
position: absolute; | ||
top: 34pt; | ||
top: 0; | ||
right: 0; | ||
} | ||
#their-voice { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters