Commit c59a4ab6 authored by stef's avatar stef

[enh] #37 - needs some styling

parent 04853590
......@@ -193,10 +193,28 @@ def ajax(request, country=None, operator=None):
def index(request):
v_list = Violation.objects.filter(activationid='',featuredcase__isnull=False).order_by('id').reverse()[:3]
form = AddViolation()
reports=sorted([(i['total'],i['id'])
for i in Violation.objects.values('id').filter(activationid='').annotate(total=Count('confirmation'))],
reverse=True)
countries=sorted([(i['total'],i['country'])
for i in Violation.objects.values('country').filter(activationid='').annotate(total=Count('country'))],
reverse=True)
confirms=sorted([(i['total'],i['country'])
for i in Violation.objects.values('country').filter(activationid='').annotate(total=Count('confirmation'))],
reverse=True)
operators=sorted([(i['total'],i['operator'])
for i in Violation.objects.values('operator').filter(activationid='').annotate(total=Count('confirmation'))],
reverse=True)
return render_to_response(
'index.html',
{ 'form': form,
'stats': [ ('Countries with reports(confirmed)', len(countries), len([i for i,_ in confirms if i>1])),
('Total reports (confirmed)', sum([i for i,_ in countries]),len([i for i,_ in reports if i>1])),
('Total Operators with reports(confirmed)', len(operators), len([x for x in operators if x[0]>1])),
('Total confirmations(most)', sum([i for i, _ in confirms]), reports[0][0]),
],
'violations': v_list },
context_instance=RequestContext(request))
......
......@@ -694,3 +694,7 @@ tr.ooscope-status td { background: #aaa !important; }
.legendclass2 { background: rgba(255, 138, 00, 0.4);}
.legendclass1 { background: rgba(255, 204, 00, 0.4);}
.legendclass0 { background: rgba(255, 255, 00, 0.4);}
.inline { display: inline; }
.stat dt { width: 20em; display: inline-block; }
......@@ -12,6 +12,7 @@
<script type="text/javascript" src="{%media_url%}/js/jquery.tablesorter.min.js"> </script>
<script type="text/javascript" src="{%media_url%}/js/form.js"></script>
<script type="text/javascript">
var json = {{stats_graph|safe}};
function focushandlers(ed) {
var s = ed.settings;
var realID = $('#'+ed.id+'_tbl');
......@@ -124,6 +125,13 @@ $(document).ready(function(){
<p>{% trans "Help us chart all the ways that internet providers are violating our online freedom. Tell us about how your landline or mobile operator Internet provider restricts your connection. You can do so in less than two minutes!" %}
<p>{% trans "We will report these violations to the European Commission and national authorities and demand action to address them." %}</p>
<p>{% trans "Don't hesitate to give us feedback on this application by reporting any idea or issue with RespectMyNet.eu here : <a href='https://nnmon.quadpad.lqdn.fr/feedback'>Feedback pad page</a>" %}</p>
<h2>{% trans "Statistics" %}</h2>
<div id="stats_graph" ></div>
<ul id="stats">
{% for t, n, n1 in stats %}
<li class="stat"><dl><dt class="inline">{{t}}</dt><dd class="inline">{{n}}({{n1}})</dd></dl></li>
{% endfor %}
</ul>
<h2>{% trans "Featured Cases" %}</h2>
<table id="featured_cases">
<thead>
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment