Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
piks3l
Respect My Net
Commits
dccf375b
Commit
dccf375b
authored
Feb 15, 2016
by
Okhin
Browse files
Nice colour for the map, and removing unnecessary code in bt/views.py, fix #21
parent
86ea74e0
Changes
2
Hide whitespace changes
Inline
Side-by-side
bt/views.py
View file @
dccf375b
...
...
@@ -234,13 +234,9 @@ 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
,
"country"
:
country
,
"status"
:
STATUS
},
context_instance
=
RequestContext
(
request
))
...
...
@@ -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
]),
...
...
nnmon/media/js/map.js
View file @
dccf375b
...
...
@@ -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
'
};
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment