 Issue 5664623214723072:
  Issue 1560 - ZeroDivisionError in sitescripts.stats.bin.pagegenerator  (Closed)
    
  
    Issue 5664623214723072:
  Issue 1560 - ZeroDivisionError in sitescripts.stats.bin.pagegenerator  (Closed) 
  | Left: | ||
| Right: | 
| OLD | NEW | 
|---|---|
| 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 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 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 {%- set params = {"totalhits": data.hits, "totalbandwidth": data.bandwid th, "field": {"name": None}} %} | 127 {%- | 
| 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 %} | |
| 128 {%- else %} | 134 {%- else %} | 
| 129 {%- set items = data.day|sortfield("day") %} | 135 {%- set items = data.day|sortfield("day") %} | 
| 130 {%- set params = {"totalhits": items|sumhits, "totalbandwidth": items|su mbandwidth, "field": {"name": None}} %} | 136 {%- set params = {"totalhits": items|sumhits, "totalbandwidth": items|su mbandwidth, "field": {"name": None}} %} | 
| 131 {%- endif %} | 137 {%- endif %} | 
| 132 <div id="overview" class="block_title">Overview</div> | 138 <div id="overview" class="block_title">Overview</div> | 
| 133 <div class="block"> | 139 <div class="block"> | 
| 134 <table align="center"> | 140 <table align="center"> | 
| 135 <tr> | 141 <tr> | 
| 136 <th bgcolor="#ECECEC">Condition</th> | 142 <th bgcolor="#ECECEC">Condition</th> | 
| 137 <th bgcolor="#66DDEE" colspan="2">Hits</th> | 143 <th bgcolor="#66DDEE" colspan="2">Hits</th> | 
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 193 {%- endif %} | 199 {%- endif %} | 
| 194 {%- if field.name == "day" and filterFields|length == 0 %} | 200 {%- if field.name == "day" and filterFields|length == 0 %} | 
| 195 {{row("Total", {"hits": params.totalhits, "bandwidth": params.tota lbandwidth}, params, special=True, emph=True, chart=False)}} | 201 {{row("Total", {"hits": params.totalhits, "bandwidth": params.tota lbandwidth}, params, special=True, emph=True, chart=False)}} | 
| 196 {%- endif %} | 202 {%- endif %} | 
| 197 </table> | 203 </table> | 
| 198 </div> | 204 </div> | 
| 199 {%- endif %} | 205 {%- endif %} | 
| 200 {%- endfor %} | 206 {%- endfor %} | 
| 201 </body> | 207 </body> | 
| 202 </html> | 208 </html> | 
| OLD | NEW |