Commit dccf375b authored by Okhin's avatar Okhin

Nice colour for the map, and removing unnecessary code in bt/views.py, fix #21

parent 86ea74e0
......@@ -234,10 +234,6 @@ def filter_violations(request, country, operator=None):
violations = Violation.objects.filter(activationid='', country=country, operator_ref__name=operator)
if not request.GET.get('all'):
violations = violations.exclude(state__in=['duplicate', 'closed'])
countries=sorted([(i['total'],i['country'])
for i in Violation.objects.values('country').filter(activationid='',country=country).exclude(state__in=['duplicate', 'closed']).annotate(total=Count('country'))],
reverse=True)
countryweights=json.dumps([{'iso2': y, 'w': x} for x, y in countries])
return render_to_response('list.html',
{ "violations": violations,
"country": country,
......@@ -252,11 +248,6 @@ def list_violations(request):
for i in Violation.objects.values('country').filter(activationid='').exclude(state__in=['duplicate', 'closed']).annotate(total=Count('country'))],
reverse=True)
countryweights=json.dumps([{'iso2': y, 'w': x} for x, y in countries])
#countrycolors=json.dumps(dict([(c.lower(),"#ff%02x00" % (w*768/(countries[0][0]+1)%256)) for w,c in countries]))
#confirms=sorted([(i['total'],i['country'])
# for i in Violation.objects.values('country').filter(activationid='').annotate(total=Count('confirmation'))
# if i['total']>1],
# reverse=True)
return render_to_response('list.html',
{"violations": violations,
"countries": dict([(y,x) for x,y in countries]),
......
......@@ -17,13 +17,7 @@ $(document).ready(function() {
dataset[iso] = { numberOfCases: value, fillColor: paletteScale(value)};
});
/* We want to highlight a country if we've selected one */
var url_segments = window.location.pathname.split('/');
url_segments.pop(); //This one is empty
var country = url_segments.pop(),
page = url_segments.pop();
if (page === 'list') {
if (country) {
dataset[country] = {fillColor: '#02386F'};
}
......
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