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

Delta Between Two Patch Sets: sitescripts/stats/template/fileStats.html

Issue 5664623214723072: Issue 1560 - ZeroDivisionError in sitescripts.stats.bin.pagegenerator (Closed)
Left Patch Set: Created Nov. 12, 2014, 7:43 p.m.
Right Patch Set: Better work-around for zero divisors Created Nov. 12, 2014, 8:55 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
« no previous file with change/comment | « sitescripts/stats/template/fileOverview.html ('k') | sitescripts/stats/template/main.html » ('j') | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
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-2014 Eyeo GmbH 3 - Copyright (C) 2006-2014 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
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 <div class="flag {{name}}"></div> {{name|countryname}} <div class="c ountrycode">{{name}}</div> 81 <div class="flag {{name}}"></div> {{name|countryname}} <div class="c ountrycode">{{name}}</div>
82 {%- else -%} 82 {%- else -%}
83 {{name}} 83 {{name}}
84 {%- endif -%} 84 {%- endif -%}
85 85
86 {%- if filtered_url %} 86 {%- if filtered_url %}
87 </a> 87 </a>
88 {%- endif %} 88 {%- endif %}
89 </td> 89 </td>
90 <td align="right">{{value.hits}}</td> 90 <td align="right">{{value.hits}}</td>
91 <td align="right">{{(value.hits / params.totalhits * 100)|round(precisio n=1)}}%</td> 91 <td align="right">{{value.hits|percentage(params.totalhits)|round(precis ion=1)}}%</td>
92 <td align="right">{{value.bandwidth|bytes}}</td> 92 <td align="right">{{value.bandwidth|bytes}}</td>
93 <td align="right">{{(value.bandwidth / params.totalbandwidth * 100)|roun d(precision=1)}}%</td> 93 <td align="right">{{value.bandwidth|percentage(params.totalbandwidth)|ro und(precision=1)}}%</td>
94 {%- if chart %} 94 {%- if chart %}
95 <td class="chart"> 95 <td class="chart">
96 <div class="hitsChart" style="width: {{(value.hits / params.maxhits * 100)|round(method='ceil')|int}}px;"></div><br /> 96 <div class="hitsChart" style="width: {{value.hits|percentage(params. maxhits)|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> 97 <div class="bandwidthChart" style="width: {{value.bandwidth|percenta ge(params.maxbandwidth)|round(method='ceil')|int}}px;"></div>
98 </td> 98 </td>
99 {%- else %} 99 {%- else %}
100 <td>&nbsp;</td> 100 <td>&nbsp;</td>
101 {%- endif %} 101 {%- endif %}
102 </tr> 102 </tr>
103 {%- endmacro %} 103 {%- endmacro %}
104 104
105 {# Using selectattr filter would be nice but servers don't have Jinja 2.7 ye t #} 105 {# Using selectattr filter would be nice but servers don't have Jinja 2.7 ye t #}
106 {%- set filterFields = [] %} 106 {%- set filterFields = [] %}
107 {%- for field in fields %} 107 {%- for field in fields %}
108 {%- if field.filter and field.name in data and "True" in data[field.name] %} 108 {%- if field.filter and field.name in data and "True" in data[field.name] %}
109 {%- set dummy = filterFields.append(field) %} 109 {%- set dummy = filterFields.append(field) %}
110 {%- endif %} 110 {%- endif %}
111 {%- endfor %} 111 {%- endfor %}
112 112
113 <div id="quickLinks"> 113 <div id="quickLinks">
114 {%- if filterFields|length > 0 %} 114 {%- if filterFields|length > 0 %}
115 <a href="#overview">Overview</a> 115 <a href="#overview">Overview</a>
116 {%- endif %} 116 {%- endif %}
117 117
118 {%- for field in fields %} 118 {%- for field in fields %}
119 {%- if not field.filter and not field.hidden and field.name in data %} 119 {%- if not field.filter and not field.hidden and field.name in data %}
120 <a href="#{{field.name}}">{{field.title}}</a> 120 <a href="#{{field.name}}">{{field.title}}</a>
121 {%- endif %} 121 {%- endif %}
122 {%- endfor %} 122 {%- endfor %}
123 </div> 123 </div>
124 124
125 {%- if filterFields|length > 0 %} 125 {%- if filterFields|length > 0 %}
126 {%- if filter %} 126 {%- if filter %}
127 {%- 127 {%- set params = {"totalhits": data.hits, "totalbandwidth": data.bandwid th, "field": {"name": None}} %}
128 set params = {
129 "totalhits": data.hits if data.hits != 0 else 1,
Sebastian Noack 2014/11/12 20:13:58 If there are no hits there aren't any. IMO, preten
Wladimir Palant 2014/11/12 20:56:36 Yes, you reviewed that workaround for other occasi
130 "totalbandwidth": data.bandwidth if data.bandwidth != 0 else 1,
131 "field": {"name": None}
132 }
133 %}
134 {%- else %} 128 {%- else %}
135 {%- set items = data.day|sortfield("day") %} 129 {%- set items = data.day|sortfield("day") %}
136 {%- set params = {"totalhits": items|sumhits, "totalbandwidth": items|su mbandwidth, "field": {"name": None}} %} 130 {%- set params = {"totalhits": items|sumhits, "totalbandwidth": items|su mbandwidth, "field": {"name": None}} %}
137 {%- endif %} 131 {%- endif %}
138 <div id="overview" class="block_title">Overview</div> 132 <div id="overview" class="block_title">Overview</div>
139 <div class="block"> 133 <div class="block">
140 <table align="center"> 134 <table align="center">
141 <tr> 135 <tr>
142 <th bgcolor="#ECECEC">Condition</th> 136 <th bgcolor="#ECECEC">Condition</th>
143 <th bgcolor="#66DDEE" colspan="2">Hits</th> 137 <th bgcolor="#66DDEE" colspan="2">Hits</th>
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
199 {%- endif %} 193 {%- endif %}
200 {%- if field.name == "day" and filterFields|length == 0 %} 194 {%- if field.name == "day" and filterFields|length == 0 %}
201 {{row("Total", {"hits": params.totalhits, "bandwidth": params.tota lbandwidth}, params, special=True, emph=True, chart=False)}} 195 {{row("Total", {"hits": params.totalhits, "bandwidth": params.tota lbandwidth}, params, special=True, emph=True, chart=False)}}
202 {%- endif %} 196 {%- endif %}
203 </table> 197 </table>
204 </div> 198 </div>
205 {%- endif %} 199 {%- endif %}
206 {%- endfor %} 200 {%- endfor %}
207 </body> 201 </body>
208 </html> 202 </html>
LEFTRIGHT

Powered by Google App Engine
This is Rietveld