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

Unified Diff: sitescripts/logs/template/subscriptionOverview.html

Issue 9503001: Subscription stats: Make sure there can be no division by zero errors (Closed)
Patch Set: Fixed the issue in all the relevant places now Created March 1, 2013, 8:29 a.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « sitescripts/logs/template/subscription.html ('k') | sitescripts/logs/template/subscriptionsMain.html » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sitescripts/logs/template/subscriptionOverview.html
===================================================================
--- a/sitescripts/logs/template/subscriptionOverview.html
+++ b/sitescripts/logs/template/subscriptionOverview.html
@@ -37,19 +37,20 @@
<td>{{now|formattime}}</td>
</tr>
</table>
<div class="block_title">Monthly history</div>
<div class="block">
<table align="center" style="margin-bottom: 20px;">
<tr align="bottom">
- {%- set maxHits, maxBandwidth = month|max(attribute='hits'), month|max(attribute='bandwidth') %}
- {%- set totalHits = month|sum(attribute='hits') %}
- {%- set totalBandwidth = month|sum(attribute='bandwidth') %}
+ {%- set maxHits = month|max(attribute='hits')|ensuremin(1) %}
+ {%- set maxBandwidth = month|max(attribute='bandwidth')|ensuremin(1) %}
+ {%- set totalHits = month|sum(attribute='hits')|ensuremin(1) %}
+ {%- set totalBandwidth = month|sum(attribute='bandwidth')|ensuremin(1) %}
{%- for info in month %}
<td align="center" style="vertical-align: bottom;">
<div class="hitsChart vertical" title="Hits: {{info.hits}}" style="height: {{(info.hits / maxHits * 100)|round(method='ceil')|int}}px;"></div>
{{- '' -}}
<div class="bandwidthChart vertical" title="Bandwidth: {{info.bandwidth|bytes}}" style="height: {{(info.bandwidth / maxBandwidth * 100)|round(method='ceil')|int}}px;"></div>
</td>
{%- endfor %}
</tr>
« no previous file with comments | « sitescripts/logs/template/subscription.html ('k') | sitescripts/logs/template/subscriptionsMain.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld