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

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

Issue 9503001: Subscription stats: Make sure there can be no division by zero errors (Closed)
Patch Set: Created March 1, 2013, 8:05 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 | « .hgsubstate ('k') | sitescripts/logs/template/subscriptionOverview.html » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sitescripts/logs/template/subscription.html
===================================================================
--- a/sitescripts/logs/template/subscription.html
+++ b/sitescripts/logs/template/subscription.html
@@ -43,19 +43,20 @@
<td>Month {{month|monthname}} (<a href="{{overviewURL}}">To overview page</a>)</td>
</tr>
</table>
<div class="block_title">Days of month</div>
<div class="block">
<table align="center" style="margin-bottom: 20px;">
<tr align="bottom">
- {%- set maxHits, maxBandwidth = day|max(attribute='hits'), day|max(attribute='bandwidth') %}
- {%- set totalHits = day|sum(attribute='hits') %}
- {%- set totalBandwidth = day|sum(attribute='bandwidth') %}
+ {%- set maxHits = day|max(attribute='hits')|ensuremin(1) %}
+ {%- set maxBandwidth = day|max(attribute='bandwidth')|ensuremin(1) %}
+ {%- set totalHits = day|sum(attribute='hits')|ensuremin(1) %}
+ {%- set totalBandwidth = day|sum(attribute='bandwidth')|ensuremin(1) %}
{%- set dayCount = day|length %}
{%- if currentMonth and dayCount > 1 %}
{%- set totalHits = totalHits - day[-1].hits %}
{%- set totalBandwidth = totalBandwidth - day[-1].bandwidth %}
{%- set dayCount = dayCount - 1 %}
{%- endif %}
{%- for info in day %}
<td align="center" style="vertical-align: bottom;">
« no previous file with comments | « .hgsubstate ('k') | sitescripts/logs/template/subscriptionOverview.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld