Skip to content
This repository has been archived by the owner on Feb 8, 2018. It is now read-only.

Commit

Permalink
Show tip distribution per person to admins (#329)
Browse files Browse the repository at this point in the history
  • Loading branch information
chadwhitacre committed Oct 10, 2012
1 parent c269965 commit ce7f740
Showing 1 changed file with 6 additions and 19 deletions.
25 changes: 6 additions & 19 deletions www/%participant_id/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -59,12 +59,13 @@
backed_amount = get_backed_amount(participant['id'])

if not user.ANON:
if user.id == participant_id or user.ADMIN:
giving_histogram, npatrons, contributed = \
get_histogram_of_giving(participant['id'])
if user.id == participant_id:
tips, total = get_tips_and_total(user.id)
if total == 0:
tips = tip_suggestions
giving_histogram, npatrons, contributed = \
get_histogram_of_giving(participant['id'])
assert backed_amount == contributed, (backed_amount, contributed)
else:
my_tip = get_tip(user.id, participant['id'])
Expand Down Expand Up @@ -537,23 +538,7 @@ <h2>You receive ${{ backed_amount }} per week.
<p>Here&rsquo;s a breakdown of this estimate by tip amount, showing the
percentage of the number of tips:</p>

<table id="tip-distribution">
{% for amount, ncontributors, summed, pcontributors, psummed in giving_histogram %}
<tr>
{% if str(amount) == '-1' %}
<td class="amount" colspan="2">Other</td>
{% else %}
<td class="dollar-sign">$</td>
<td class="amount">{{ amount }}</td>
{% end %}
<td class="count">
<span class="bar" style="width:{{ pcontributors * 300 }}pt"></span>
{{ "%5.1f" % (pcontributors * 100) }}%
<span class="number">({{ ncontributors }})</span>
</td>
</tr>
{% end %}
</table>
{% include "templates/tip-distribution.html" %}

<p><br />Here&rsquo;s the same info, but showing the percentage of the
total dollar amount of your tips:</p>
Expand Down Expand Up @@ -644,6 +629,8 @@ <h3>{{ participant['id'] }} joined {{ to_age(participant['claimed_time']) }}.
<span class="small"><a href="history.html">History</a></span>
</h3>

{% include "templates/tip-distribution.html" %}

{% end %}

<h3>Linked Accounts</h3>
Expand Down

0 comments on commit ce7f740

Please sign in to comment.