Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
R
Respect My Net
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
piks3l
Respect My Net
Commits
f1260f98
Commit
f1260f98
authored
Nov 21, 2011
by
Baptiste Jonglez
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[enh] rephrase statistics and exclude ooscope/closed/duplicate
parent
a1ef8482
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
11 deletions
+12
-11
bt/views.py
bt/views.py
+9
-9
templates/index.html
templates/index.html
+3
-2
No files found.
bt/views.py
View file @
f1260f98
...
...
@@ -194,24 +194,24 @@ 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'
))],
for
i
in
Violation
.
objects
.
values
(
'id'
).
filter
(
activationid
=
''
).
exclude
(
state
=
[
'ooscope'
,
'closed'
,
'duplicate'
]).
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
)
#
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'
))],
for
i
in
Violation
.
objects
.
values
(
'country'
).
filter
(
activationid
=
''
).
exclude
(
state
=
[
'ooscope'
,
'closed'
,
'duplicate'
]).
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'
))],
for
i
in
Violation
.
objects
.
values
(
'operator'
).
filter
(
activationid
=
''
).
exclude
(
state
=
[
'ooscope'
,
'closed'
,
'duplicate'
]).
annotate
(
total
=
Count
(
'confirmation'
))],
reverse
=
True
)
return
render_to_response
(
'index.html'
,
{
'form'
:
form
,
'stats'
:
[
(
_
(
'Total
reports (confirmed)'
),
sum
([
i
for
i
,
z
in
countries
]),
len
([
i
for
i
,
z
in
reports
if
i
>
1
])),
(
_
(
'Countries with
reports (confirmed)'
),
len
(
countries
),
len
([
i
for
i
,
z
in
confirms
if
i
>
1
])),
(
_
(
'Operators with
reports (confirmed)'
),
len
(
operators
),
len
([
x
for
x
in
operators
if
x
[
0
]
>
1
])),
'stats'
:
[
(
_
(
'Total
confirmed reports'
),
len
([
i
for
i
,
z
in
reports
if
i
>
1
])),
(
_
(
'Countries with
some confirmed reports'
),
len
([
i
for
i
,
z
in
confirms
if
i
>
1
])),
(
_
(
'Operators with
some confirmed reports'
),
len
([
i
for
i
,
z
in
operators
if
i
>
1
])),
],
'violations'
:
v_list
},
context_instance
=
RequestContext
(
request
))
...
...
templates/index.html
View file @
f1260f98
...
...
@@ -127,10 +127,11 @@ $(document).ready(function(){
<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>
{% for t, n in stats %}
<li
class=
"stat"
><dl><dt
class=
"inline"
>
{{t}}
</dt><dd
class=
"inline"
>
<strong>
{{n}}
</strong>
</dd></dl></li>
{% endfor %}
</ul>
<h2>
{% trans "Featured Cases" %}
</h2>
<table
id=
"featured_cases"
>
<thead>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a 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