Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Side by Side Diff: sitescripts/stats/template/fileStats.html

Issue 11481051: Update stats processing (Closed)
Patch Set: Fixed two presentation issues Created Aug. 24, 2013, 1:11 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
OLDNEW
1 <!-- 1 <!--
2 - This file is part of the Adblock Plus web scripts, 2 - This file is part of the Adblock Plus web scripts,
3 - Copyright (C) 2006-2013 Eyeo GmbH 3 - Copyright (C) 2006-2013 Eyeo GmbH
4 - 4 -
5 - Adblock Plus is free software: you can redistribute it and/or modify 5 - Adblock Plus is free software: you can redistribute it and/or modify
6 - it under the terms of the GNU General Public License version 3 as 6 - it under the terms of the GNU General Public License version 3 as
7 - published by the Free Software Foundation. 7 - published by the Free Software Foundation.
8 - 8 -
9 - Adblock Plus is distributed in the hope that it will be useful, 9 - Adblock Plus is distributed in the hope that it will be useful,
10 - but WITHOUT ANY WARRANTY; without even the implied warranty of 10 - but WITHOUT ANY WARRANTY; without even the implied warranty of
11 - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 - GNU General Public License for more details. 12 - GNU General Public License for more details.
13 - 13 -
14 - You should have received a copy of the GNU General Public License 14 - You should have received a copy of the GNU General Public License
15 - along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>. 15 - along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>.
16 --> 16 -->
17 17
18
19 <!DOCTYPE html> 18 <!DOCTYPE html>
20 <html lang="en"> 19 <html lang="en">
21 <head> 20 <head>
22 <meta name="robots" content="noindex,nofollow" /> 21 <meta name="robots" content="noindex,nofollow" />
23 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 22 <meta charset="utf-8">
24 <link rel="stylesheet" type="text/css" href="static/subscriptions.css" /> 23 <link rel="stylesheet" type="text/css" href="../../../static/stats.css" />
25 <link rel="stylesheet" type="text/css" href="static/flags.css" /> 24 <link rel="stylesheet" type="text/css" href="../../../static/flags.css" />
26 <link rel="stylesheet" type="text/css" href="static/hours.css" /> 25 <link rel="stylesheet" type="text/css" href="../../../static/hours.css" />
27 <title>Statistics for filter subscription {{fileName}} ({{month|monthname}}) </title> 26 <title>Statistics for file {{fileName}} ({{month|monthname}})</title>
27 <script type="text/javascript">
28 document.addEventListener("click", function(event)
29 {
30 if (event.target.className == "showAllLink")
31 {
32 document.getElementById(event.target.getAttribute("data-hide")).style. display = "none";
33 document.getElementById(event.target.getAttribute("data-show")).style. display = "";
34 event.preventDefault();
35 }
36 }, false);
37 </script>
28 </head> 38 </head>
29 39
30 <body style="margin-top: 0px"> 40 <body style="margin-top: 0px">
31 <a name="top">&nbsp;</a> 41 <a name="top">&nbsp;</a>
32 <table class="block" width="100%"> 42 <table class="block" width="100%">
33 <tr> 43 <tr>
34 <td class="title" width="250">Statistics for subscription:</td> 44 <td class="title" width="250">Statistics for file:</td>
35 <td>easylist-downloads.adblockplus.org/{{fileName}}</td> 45 <td>{{url}}</td>
36 </tr> 46 </tr>
37 <tr> 47 <tr>
38 <td class="title" width="250">Last update:</td> 48 <td class="title" width="250">Last update:</td>
39 <td>{{now|formattime}}</td> 49 <td>{{now|formattime}}</td>
40 </tr> 50 </tr>
41 <tr> 51 <tr>
42 <td class="title" width="250">Reported period:</td> 52 <td class="title" width="250">Reported period:</td>
43 <td>Month {{month|monthname}} (<a href="{{overviewURL}}">To overview pag e</a>)</td> 53 <td>Month {{month|monthname}} (<a href="{{overview_url}}">To overview pa ge</a>)</td>
44 </tr> 54 </tr>
55 {%- if filter %}
56 <tr>
57 <td class="title" width="250">Filter:</td>
58 <td>
59 {%- if filter.field.filter %}
60 {{filter.field.title}} only
61 {%- else %}
62 {{filter.field.coltitle}} is {{filter.value}}
63 {%- endif %}
64 (<a href="index.html">Remove filter</a>)</td>
65 </tr>
66 {%- endif %}
45 </table> 67 </table>
46 68
47 <div class="block_title">Days of month</div> 69 {%- macro row(name, value, params, special=False, emph=False, chart=True, fi ltered_url=None) %}
48 <div class="block"> 70 <tr{% if special %} class="special"{% endif%}>
49 <table align="center" style="margin-bottom: 20px;"> 71 <td{% if emph %} class="emph"{% endif%}>
50 <tr align="bottom"> 72 {%- if filtered_url %}
51 {%- set maxHits = day|max(attribute='hits')|ensuremin(1) %} 73 <a href="{{filtered_url}}">
52 {%- set maxBandwidth = day|max(attribute='bandwidth')|ensuremin(1) %}
53 {%- set totalHits = day|sum(attribute='hits')|ensuremin(1) %}
54 {%- set totalBandwidth = day|sum(attribute='bandwidth')|ensuremin(1) % }
55 {%- set dayCount = day|length %}
56 {%- if currentMonth and dayCount > 1 %}
57 {%- set totalHits = totalHits - day[-1].hits %}
58 {%- set totalBandwidth = totalBandwidth - day[-1].bandwidth %}
59 {%- set dayCount = dayCount - 1 %}
60 {%- endif %} 74 {%- endif %}
61 {%- for info in day %} 75
62 <td align="center" style="vertical-align: bottom;"> 76 {%- if not special and params.field.name == "hour" -%}
63 <div class="hitsChart vertical" title="Hits: {{info.hits}}" style="h eight: {{(info.hits / maxHits * 100)|round(method='ceil')|int}}px;"></div> 77 <div class="hour hour{{name|int % 12 + 1}}"></div> {{name}}
64 {{- '' -}} 78 {%- elif not special and params.field.name == "weekday" -%}
65 <div class="bandwidthChart vertical" title="Bandwidth: {{info.bandwi dth|bytes}}" style="height: {{(info.bandwidth / maxBandwidth * 100)|round(method ='ceil')|int}}px;"></div> 79 {{name|weekday}}
80 {%- elif not special and params.field.name == "country" -%}
81 <div class="flag {{name}}"></div> {{name|countryname}} <div class="c ountrycode">{{name}}</div>
82 {%- else -%}
83 {{name}}
84 {%- endif -%}
85
86 {%- if filtered_url %}
87 </a>
88 {%- endif %}
89 </td>
90 <td align="right">{{value.hits}}</td>
91 <td align="right">{{(value.hits / params.totalhits * 100)|round(precisio n=1)}}%</td>
92 <td align="right">{{value.bandwidth|bytes}}</td>
93 <td align="right">{{(value.bandwidth / params.totalbandwidth * 100)|roun d(precision=1)}}%</td>
94 {%- if chart %}
95 <td class="chart">
96 <div class="hitsChart" style="width: {{(value.hits / params.maxhits * 100)|round(method='ceil')|int}}px;"></div><br />
97 <div class="bandwidthChart" style="width: {{(value.bandwidth / param s.maxbandwidth * 100)|round(method='ceil')|int}}px;"></div>
66 </td> 98 </td>
67 {%- if loop.last and info.id|int < daysInMonth %} 99 {%- else %}
68 {%- for dummyDay in range(info.id|int + 1, daysInMonth + 1) %} 100 <td>&nbsp;</td>
69 <td align="center" style="vertical-align: bottom;"> 101 {%- endif %}
70 <div class="hitsChart vertical" title="Hits: 0" style="height: 1 px;"></div> 102 </tr>
71 {{- '' -}} 103 {%- endmacro %}
72 <div class="bandwidthChart vertical" title="Bandwidth: 1" style= "height: 1px;"></div> 104
105 {# Using selectattr filter would be nice but servers don't have Jinja 2.7 ye t #}
106 {%- set filterFields = [] %}
107 {%- for field in fields %}
108 {%- if field.filter and field.name in data and "true" in data[field.name] %}
109 {%- set dummy = filterFields.append(field) %}
110 {%- endif %}
111 {%- endfor %}
112
113 <div id="quickLinks">
114 {%- if filterFields|length > 0 %}
115 <a href="#overview">Overview</a>
116 {%- endif %}
117
118 {%- for field in fields %}
119 {%- if not field.filter and field.name in data %}
120 <a href="#{{field.name}}">{{field.title}}</a>
121 {%- endif %}
122 {%- endfor %}
123 </div>
124
125 {%- if filterFields|length > 0 %}
126 {%- if filter %}
127 {%- set params = {"totalhits": data.hits, "totalbandwidth": data.bandwid th, "field": {"name": None}} %}
128 {%- else %}
129 {%- set items = data.day|sortfield("day") %}
130 {%- set params = {"totalhits": items|sumhits, "totalbandwidth": items|su mbandwidth, "field": {"name": None}} %}
131 {%- endif %}
132 <div id="overview" class="block_title">Overview</div>
133 <div class="block">
134 <table align="center">
135 <tr>
136 <th bgcolor="#ECECEC">Condition</th>
137 <th bgcolor="#66DDEE" colspan="2">Hits</th>
138 <th bgcolor="#2EA495" colspan="2">Bandwidth</th>
139 </tr>
140 {%- for field in filterFields %}
141 {{row(field.title, data[field.name].true, params, chart=False,
142 filtered_url=filtered_urls.get(field.name, {}).get("true", Non e))}}
143 {%- endfor %}
144 {{row("Total", {"hits": params.totalhits, "bandwidth": params.totalban dwidth}, params, special=True, emph=True, chart=False)}}
145 </table>
146 </div>
147 {%- endif %}
148
149 {%- for field in fields %}
150 {%- if not field.filter and field.name in data %}
151 {%- set items = data[field.name]|sortfield(field) %}
152 {%- set params = {"maxhits": items|maxhits, "maxbandwidth": items|maxban dwidth,
153 "totalhits": items|sumhits, "totalbandwidth": items|su mbandwidth,
154 "field": field} %}
155 {%- set count = items|length %}
156 <div id="{{field.name}}" class="block_title">{{field.title}}</div>
157 <div class="block">
158 <table align="center">
159 <tr>
160 <th bgcolor="#ECECEC">{{field.coltitle}}</th>
161 <th bgcolor="#66DDEE" colspan="2">Hits</th>
162 <th bgcolor="#2EA495" colspan="2">Bandwidth</th>
163 </tr>
164 {%- for name, value in items[0:30] %}
165 {{row(name, value, params, special=name|isspecial(field),
166 filtered_url=filtered_urls.get(field.name, {}).get(name, None))} }
167 {%- endfor %}
168 {%- if count > 30 %}
169 <tr id="{{field.name}}_showAll" class="special">
170 <td>
171 Other
172 <a href="#" class="showAllLink" data-hide="{{field.name}}_showAl l" data-show="{{field.name}}_additionalItems">
173 Show all
174 </a>
73 </td> 175 </td>
74 {%- endfor %} 176 <td align="right">{{items[30:]|sumhits}}</td>
75 {%- endif %} 177 <td>&nbsp;</td>
76 {%- endfor %} 178 <td align="right">{{items[30:]|sumbandwidth|bytes}}</td>
77 {%- set avgHits = (totalHits / dayCount)|int %} 179 <td>&nbsp;</td>
78 {%- set avgBandwidth = (totalBandwidth / dayCount)|int %} 180 <td>&nbsp;</td>
79 <td align="center" style="vertical-align: bottom;"> 181 </tr>
80 <div class="hitsChart vertical" title="Hits: {{avgHits}}" style="hei ght: {{(avgHits / maxHits * 100)|round(method='ceil')|int}}px;"></div> 182 <tbody id="{{field.name}}_additionalItems" style="display: none;">
81 {{- '' -}} 183 {%- for name, value in items[30:] %}
82 <div class="bandwidthChart vertical" title="Bandwidth: {{avgBandwidt h|bytes}}" style="height: {{(avgBandwidth / maxBandwidth * 100)|round(method='ce il')|int}}px;"></div> 184 {{row(name, value, params, special=name|isspecial(field),
83 </td> 185 filtered_url=filtered_urls.get(field.name, {}).get(name, None) )}}
84 </tr> 186 {%- endfor %}
85 <tr> 187 </tbody>
86 {%- for info in day %} 188 {%- endif %}
87 <td align="center"{% if info.weekday > 4 %} class="special"{% endif %} > 189 {%- if field.showaverage %}
88 {{info.id}}<br /> 190 {%- set avghits = (params.totalhits / count)|int %}
89 {{month|monthname(format='%b')}} 191 {%- set avgbandwidth = (params.totalbandwidth / count)|int %}
90 </td> 192 {{row("Average", {"hits": avghits, "bandwidth": avgbandwidth}, par ams, special=True, emph=True)}}
91 {%- if loop.last and info.id|int < daysInMonth %} 193 {%- endif %}
92 {%- for dummyDay in range(info.id|int + 1, daysInMonth + 1) %} 194 {%- if field.name == "day" and filterFields|length == 0 %}
93 <td align="center"> 195 {{row("Total", {"hits": params.totalhits, "bandwidth": params.tota lbandwidth}, params, special=True, emph=True, chart=False)}}
94 {{dummyDay}}<br /> 196 {%- endif %}
95 {{month|monthname(format='%b')}} 197 </table>
96 </td> 198 </div>
97 {%- endfor %} 199 {%- endif %}
98 {%- endif %} 200 {%- endfor %}
99 {%- endfor %}
100 <td align="center">
101 Average
102 </td>
103 </tr>
104 </table>
105
106 <table align="center">
107 <tr>
108 <th bgcolor="#ECECEC">Day</th>
109 <th bgcolor="#66DDEE" colspan="2">Hits</th>
110 <th bgcolor="#2EA495">Bandwidth</th>
111 </tr>
112 {%- for info in day %}
113 <tr{% if info.weekday > 4 %} class="special"{% endif %}>
114 <td>{{info.id}} {{month|monthname}}</td>
115 <td align="right">{{info.hits}}</td>
116 <td align="right">{{(info.hits / totalHits * 100)|round(precision=1)}} %</td>
117 <td align="right">{{info.bandwidth|bytes}}</td>
118 </tr>
119 {%- endfor %}
120 <tr class="special">
121 <td style="font-weight: bold">Average</td>
122 <td align="right">{{avgHits}}</td>
123 <td align="right">&nbsp;</td>
124 <td align="right">{{avgBandwidth|bytes}}</td>
125 </tr>
126 <tr class="special">
127 <td style="font-weight: bold">Total</td>
128 <td align="right">{{totalHits}}</td>
129 <td align="right">&nbsp;</td>
130 <td align="right">{{totalBandwidth|bytes}}</td>
131 </tr>
132 </table>
133 </div>
134
135 <div class="block_title">Days of week</div>
136 <div class="block">
137 <table align="center" style="margin-bottom: 20px;">
138 <tr align="bottom">
139 {%- set maxHits = weekday|max(attribute='hits')|ensuremin(1) %}
140 {%- set maxBandwidth = weekday|max(attribute='bandwidth')|ensuremin(1) %}
141 {%- for info in weekday %}
142 <td align="center" style="vertical-align: bottom;">
143 <div class="hitsChart vertical" title="Hits: {{info.hits}}" style="h eight: {{(info.hits / maxHits * 100)|round(method='ceil')|int}}px"></div>
144 {{- '' -}}
145 <div class="bandwidthChart vertical" alt="Bandwidth: {{info.bandwidt h|bytes}}"" title="Bandwidth: {{info.bandwidth|bytes}}" style="height: {{(info.b andwidth / maxBandwidth * 100)|round(method='ceil')|int}}px"></div>
146 </td>
147 {%- endfor %}
148 </tr>
149 <tr>
150 {%- for info in weekday %}
151 <td align="center"{% if info.id > 4 %} class="special"{% endif %}>
152 {{info.id|weekday}}
153 </td>
154 {%- endfor %}
155 </tr>
156 </table>
157
158 <table align="center">
159 <tr>
160 <th bgcolor="#ECECEC">Day</th>
161 <th bgcolor="#66DDEE" colspan="2">Hits</th>
162 <th bgcolor="#2EA495">Bandwidth</th>
163 </tr>
164 {%- set totalHits = weekday|sum(attribute='hits')|ensuremin(1) %}
165 {%- set totalBandwidth = weekday|sum(attribute='bandwidth')|ensuremin(1) %}
166 {%- for info in weekday %}
167 <tr{% if info.id > 4 %} class="special"{% endif %}>
168 <td>{{info.id|weekday}}</td>
169 <td align="right">{{info.hits}}</td>
170 <td align="right">{{(info.hits / totalHits * 100)|round(precision=1)}} %</td>
171 <td align="right">{{info.bandwidth|bytes}}</td>
172 </tr>
173 {%- endfor %}
174 </table>
175 </div>
176
177 <div class="block_title">Hours</div>
178 <div class="block">
179 <table align="center" style="margin-bottom: 20px;">
180 <tr align="bottom">
181 {%- set maxHits = hour|max(attribute='hits')|ensuremin(1) %}
182 {%- set maxBandwidth = hour|max(attribute='bandwidth')|ensuremin(1) %}
183 {%- for info in hour %}
184 <td align="center" style="vertical-align: bottom;">
185 <div class="hitsChart vertical" title="Hits: {{info.hits}}" style="h eight: {{(info.hits / maxHits * 100)|round(method='ceil')|int}}px;"></div>
186 {{- '' -}}
187 <div class="bandwidthChart vertical" title="Bandwidth: {{info.bandwi dth|bytes}}" style="height: {{(info.bandwidth / maxBandwidth * 100)|round(method ='ceil')|int}}px;"></div>
188 </td>
189 {%- if loop.last and info.id|int < 23 %}
190 {%- for dummyHour in range(info.id|int + 1, 24) %}
191 <td align="center" style="vertical-align: bottom;">
192 <div class="hitsChart vertical" title="Hits: 0" style="height: 1 px;"></div>
193 {{- '' -}}
194 <div class="bandwidthChart vertical" title="Bandwidth: 0" style= "height: 1px;"></div>
195 </td>
196 {%- endfor %}
197 {%- endif %}
198 {%- endfor %}
199 </tr>
200 <tr>
201 {%- for info in hour %}
202 <td align="center">
203 {{info.id}}<br />
204 <div class="hour hour{{info.id|int % 12 + 1}}" ></div>
205 </td>
206 {%- if loop.last and info.id|int < 23 %}
207 {%- for dummyHour in range(info.id|int + 1, 24) %}
208 <td align="center">
209 {{dummyHour}}<br />
210 <div class="hour hour{{dummyHour % 12 + 1}}" ></div>
211 </td>
212 {%- endfor %}
213 {%- endif %}
214 {%- endfor %}
215 </tr>
216 </table>
217
218 <table align="center">
219 <tr>
220 <th bgcolor="#ECECEC">Hour</th>
221 <th bgcolor="#66DDEE" colspan="2">Hits</th>
222 <th bgcolor="#2EA495">Bandwidth</th>
223 </tr>
224 {%- set totalHits = hour|sum(attribute='hits')|ensuremin(1) %}
225 {%- set totalBandwidth = hour|sum(attribute='bandwidth')|ensuremin(1) %}
226 {%- for info in hour %}
227 <tr>
228 <td>{{info.id}}</td>
229 <td align="right">{{info.hits}}</td>
230 <td align="right">{{(info.hits / totalHits * 100)|round(precision=1)}} %</td>
231 <td align="right">{{info.bandwidth|bytes}}</td>
232 </tr>
233 {%- endfor %}
234 </table>
235 </div>
236
237 {%- if app %}
238 <div class="block_title">Browsers</div>
239 <div class="block">
240 <table align="center">
241 <tr>
242 <th bgcolor="#ECECEC">Browser</th>
243 <th bgcolor="#66DDEE" colspan="2">Hits</th>
244 <th bgcolor="#2EA495">Bandwidth</th>
245 </tr>
246 {%- set maxHits = app|max(attribute='hits')|ensuremin(1) %}
247 {%- set maxBandwidth = app|max(attribute='bandwidth')|ensuremin(1) %}
248 {%- set totalHits = app|sum(attribute='hits')|ensuremin(1) %}
249 {%- set totalBandwidth = app|sum(attribute='bandwidth')|ensuremin(1) %}
250 {%- for info in app[0:10] %}
251 <tr>
252 <td>{{info.id}}</td>
253 <td align="right">{{info.hits}}</td>
254 <td align="right">{{(info.hits / totalHits * 100)|round(precision=1)}} %</td>
255 <td align="right">{{info.bandwidth|bytes}}</td>
256 <td class="chart">
257 <div class="hitsChart horizontal" style="width: {{(info.hits / maxHi ts * 100)|round(method='ceil')|int}}px;"></div><br />
258 <div class="bandwidthChart horizontal" style="width: {{(info.bandwid th / maxBandwidth * 100)|round(method='ceil')|int}}px;"></div>
259 </td>
260 </tr>
261 {%- endfor %}
262 {%- if app|length > 10 %}
263 <tr class="special" id="showotherapps">
264 <td>
265 Other
266 <a href="#" style="font-size: 80%;" onclick="getElementById('showoth erapps').style.display='none';getElementById('otherapps').style.display='';retur n false;">
267 Show all
268 </a>
269 </td>
270 <td align="right">{{app[10:]|sum(attribute='hits')}}</td>
271 <td>&nbsp;</td>
272 <td align="right">{{app[10:]|sum(attribute='bandwidth')|bytes}}</td>
273 <td>&nbsp;</td>
274 </tr>
275 <tbody id="otherapps" style="display: none;">
276 {%- for info in app[10:] %}
277 <tr>
278 <td>{{info.id}}</td>
279 <td align="right">{{info.hits}}</td>
280 <td align="right">{{(info.hits / totalHits * 100)|round(precision=1) }}%</td>
281 <td align="right">{{info.bandwidth|bytes}}</td>
282 <td class="chart">
283 <div class="hitsChart horizontal" style="width: {{(info.hits / maxHi ts * 100)|round(method='ceil')|int}}px;"></div><br />
284 <div class="bandwidthChart horizontal" style="width: {{(info.bandwid th / maxBandwidth * 100)|round(method='ceil')|int}}px;"></div>
285 </td>
286 </tr>
287 {%- endfor %}
288 </tbody>
289 {%- endif %}
290 </table>
291 </div>
292 {%- endif %}
293
294 <div class="block_title">Countries</div>
295 <div class="block">
296 <table align="center">
297 <tr>
298 <th bgcolor="#ECECEC" colspan="3">Country</th>
299 <th bgcolor="#66DDEE" colspan="2">Hits</th>
300 <th bgcolor="#2EA495">Bandwidth</th>
301 <th>&nbsp;</th>
302 </tr>
303 {%- set maxHits = country|max(attribute='hits')|ensuremin(1) %}
304 {%- set maxBandwidth = country|max(attribute='bandwidth')|ensuremin(1) % }
305 {%- set totalHits = country|sum(attribute='hits')|ensuremin(1) %}
306 {%- set totalBandwidth = country|sum(attribute='bandwidth')|ensuremin(1) %}
307 {%- for info in country[0:10] %}
308 <tr>
309 <td><div class="flag {{info.image}}"></div></td>
310 <td>{{info.name}}</td>
311 <td>{{info.id}}</td>
312 <td align="right">{{info.hits}}</td>
313 <td align="right">{{(info.hits / totalHits * 100)|round(precision=1)}} %</td>
314 <td align="right">{{info.bandwidth|bytes}}</td>
315 <td class="chart">
316 <div class="hitsChart horizontal" style="width: {{(info.hits / maxHi ts * 100)|round(method='ceil')|int}}px;"></div><br />
317 <div class="bandwidthChart horizontal" style="width: {{(info.bandwid th / maxBandwidth * 100)|round(method='ceil')|int}}px;"></div>
318 </td>
319 </tr>
320 {%- endfor %}
321 {%- if country|length > 10 %}
322 <tr class="special" id="showothercountries">
323 <td>&nbsp;</td>
324 <td>
325 Other
326 <a href="#" style="font-size: 80%;" onclick="getElementById('showoth ercountries').style.display='none';getElementById('othercountries').style.displa y='';return false;">
327 Show all
328 </a>
329 </td>
330 <td>&nbsp;</td>
331 <td align="right">{{country[10:]|sum(attribute='hits')}}</td>
332 <td>&nbsp;</td>
333 <td align="right">{{country[10:]|sum(attribute='bandwidth')|bytes}}</t d>
334 <td>&nbsp;</td>
335 </tr>
336 <tbody id="othercountries" style="display: none;">
337 {%- for info in country[10:] %}
338 <tr>
339 <td><div class="flag {{info.image}}"></div></td>
340 <td>{{info.name}}</td>
341 <td>{{info.id}}</td>
342 <td align="right">{{info.hits}}</td>
343 <td align="right">{{(info.hits / totalHits * 100)|round(precision=1) }}%</td>
344 <td align="right">{{info.bandwidth|bytes}}</td>
345 <td class="chart">
346 <div class="hitsChart horizontal" style="width: {{(info.hits / max Hits * 100)|round(method='ceil')|int}}px;"></div><br />
347 <div class="bandwidthChart horizontal" style="width: {{(info.bandw idth / maxBandwidth * 100)|round(method='ceil')|int}}px;"></div>
348 </td>
349 </tr>
350 {%- endfor %}
351 </tbody>
352 {%- endif %}
353 </table>
354 </div>
355
356 <div class="block_title">Download mirrors</div>
357 <div class="block">
358 <table align="center">
359 <tr>
360 <th bgcolor="#ECECEC">Mirror</th>
361 <th bgcolor="#66DDEE" colspan="2">Hits</th>
362 <th bgcolor="#2EA495">Bandwidth</th>
363 <th>&nbsp;</th>
364 </tr>
365 {%- set maxHits = mirror|max(attribute='hits')|ensuremin(1) %}
366 {%- set maxBandwidth = mirror|max(attribute='bandwidth')|ensuremin(1) %}
367 {%- set totalHits = mirror|sum(attribute='hits')|ensuremin(1) %}
368 {%- set totalBandwidth = mirror|sum(attribute='bandwidth')|ensuremin(1) %}
369 {%- for info in mirror %}
370 <tr>
371 <td>{{info.id}}</td>
372 <td align="right">{{info.hits}}</td>
373 <td align="right">{{(info.hits / totalHits * 100)|round(precision=1)}} %</td>
374 <td align="right">{{info.bandwidth|bytes}}</td>
375 <td class="chart">
376 <div class="hitsChart horizontal" style="width: {{(info.hits / maxHi ts * 100)|round(method='ceil')|int}}px;"></div><br />
377 <div class="bandwidthChart horizontal" style="width: {{(info.bandwid th / maxBandwidth * 100)|round(method='ceil')|int}}px;"></div>
378 </td>
379 </tr>
380 {%- endfor %}
381 </table>
382 </div>
383 </body> 201 </body>
384 </html> 202 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld