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

Commit

Permalink
Make fraud dashboard more time-based (#355)
Browse files Browse the repository at this point in the history
  • Loading branch information
chadwhitacre committed Nov 6, 2012
1 parent ce70652 commit 06d7c2b
Showing 1 changed file with 21 additions and 9 deletions.
30 changes: 21 additions & 9 deletions www/about/fraud/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
, balance
FROM participants
WHERE is_suspicious
ORDER BY ctime

""")
if _suspicious is None:
Expand Down Expand Up @@ -49,17 +50,17 @@
, amount
FROM transfers
WHERE tipper=%s OR tippee=%s
ORDER BY timestamp DESC
ORDER BY timestamp


""", (person['id'], person['id']))

person['exchanges'] = db.fetchall("""

SELECT amount, fee
SELECT amount, fee, timestamp
FROM exchanges
WHERE participant_id=%s
ORDER BY timestamp DESC
ORDER BY timestamp


""", (person['id'],))
Expand All @@ -80,9 +81,14 @@
}
.amount {
text-align: right;
padding-right: 1em;
padding-right: 6pt;
font-family: Lucida Mono, monospace;
}
}
.date {
font-family: Lucida Mono, monospace;
font-size: smaller;
color: #999;
}
.suspicious {
font-weight: bold;
color: red;
Expand All @@ -97,7 +103,7 @@ <h3>Fraud, Grommit!</h3>
<th>Suspicious Person</th>
<th></th>
<th>Balance</th>
<th>Tips</th>
<th>Tip Graph</th>
<th>Transfers</th>
<th>Exchanges</th>
</tr>
Expand All @@ -118,10 +124,12 @@ <h3>Fraud, Grommit!</h3>
{% for transfer in row['transfers'] %}
{% if row['id'] == transfer['tipper'] %}
<span class="amount">{{ str(transfer['amount']).rjust(6).replace(' ', '&nbsp;') }}</span>&rarr;
<a href="/{{ transfer['tippee'] }}/"{% if transfer['tippee'] in names %} class="suspicious"{% end %}>{{ transfer['tippee'] }}</a><br />
<a href="/{{ transfer['tippee'] }}/"{% if transfer['tippee'] in names %}
class="suspicious"{% end %}>{{ transfer['tippee'] }}</a><br />
{% else %}
<span class="amount">{{ str(transfer['amount']).rjust(6).replace(' ', '&nbsp;') }}</span>&larr;
<a href="/{{ transfer['tipper'] }}/"{% if transfer['tipper'] in names %} class="suspicious"{% end %}>{{ transfer['tipper'] }}</a><br />
<a href="/{{ transfer['tipper'] }}/"{% if transfer['tipper'] in names %}
class="suspicious"{% end %}>{{ transfer['tipper'] }}</a><br />
{% end %}
{% end %}
</td>
Expand All @@ -130,7 +138,11 @@ <h3>Fraud, Grommit!</h3>
<span class="amount{% if exchange['amount'] < 0 %} charge{% end %}">
{{ str(exchange['amount']).rjust(7).replace(' ', '&nbsp;') }}
{{ str(exchange['fee']).rjust(4).replace(' ', '&nbsp;') }}
</span><br />
</span>
<span class="date">
{{ str(exchange['timestamp'])[:10] }}
</span>
<br />
{% end %}
</td>
</tr>
Expand Down

0 comments on commit 06d7c2b

Please sign in to comment.