From e3e680005b9f6ba12b458139edaa62cf333321ba Mon Sep 17 00:00:00 2001 From: Chad Whitacre Date: Tue, 6 Nov 2012 10:30:26 -0500 Subject: [PATCH] Start a fraud dashboard (#355) --- www/about/fraud/index.html | 98 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 98 insertions(+) create mode 100644 www/about/fraud/index.html diff --git a/www/about/fraud/index.html b/www/about/fraud/index.html new file mode 100644 index 0000000000..213e6a0bd2 --- /dev/null +++ b/www/about/fraud/index.html @@ -0,0 +1,98 @@ +from aspen import Response +from gittip import db + +^L +if not user.ADMIN: + raise Response(404) + + +_suspicious = db.fetchall(""" + + SELECT id + , balance + FROM participants + WHERE payin_suspended + +""") +if _suspicious is None: + _suspicious = [] + + +def suspicious(): + for person in _suspicious: + person['gives_to'] = db.fetchall(""" + + SELECT DISTINCT tippee AS id + , payin_suspended AS is_suspicious + FROM tips + JOIN participants p + ON tippee = p.id + WHERE tipper=%s + + + """, (person['id'],)) + person['receives_from'] = db.fetchall(""" + + SELECT DISTINCT tipper AS id + , payin_suspended AS is_suspicious + FROM tips + JOIN participants p + ON tipper = p.id + WHERE tippee=%s + + """, (person['id'],)) + yield person +suspicious = suspicious() + +^L +{% extends templates/base.html %} +{% block body %} + +

Fraud, Grommit!

+ + + + + + + + + {% for row in suspicious %} + + + + + + + + {% end %} +
Suspicious PersonBalanceGives ToReceives From
{{ row['id'] }}${{ row['balance'] }} + {% for person in row['gives_to'] %} + {{ person['id'] }}
+ {% end %} +
+ {% for person in row['receives_from'] %} + {{ person['id'] }}
+ {% end %} +
+
+
+{% end %}