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

Issue 9503001: Subscription stats: Make sure there can be no division by zero errors (Closed)

Created:
March 1, 2013, 8:05 a.m. by Wladimir Palant
Modified:
March 1, 2013, 9:43 a.m.
Reviewers:
Felix Dahlke
Visibility:
Public.

Description

Subscription stats: Make sure there can be no division by zero errors

Patch Set 1 #

Patch Set 2 : Fixed the issue in all the relevant places now #

Unified diffs Side-by-side diffs Delta from patch set Stats (+54 lines, -41 lines) Patch
M .hgsubstate View 1 chunk +1 line, -1 line 0 comments Download
M sitescripts/logs/template/subscription.html View 1 7 chunks +24 lines, -18 lines 0 comments Download
M sitescripts/logs/template/subscriptionOverview.html View 1 chunk +4 lines, -3 lines 0 comments Download
M sitescripts/logs/template/subscriptionsMain.html View 2 chunks +18 lines, -18 lines 0 comments Download
M sitescripts/templateFilters.py View 2 chunks +7 lines, -1 line 0 comments Download

Messages

Total messages: 5
Wladimir Palant
March 1, 2013, 8:05 a.m. (2013-03-01 08:05:52 UTC) #1
Wladimir Palant
Found more places where divide-by-zero needs to be avoided.
March 1, 2013, 8:30 a.m. (2013-03-01 08:30:34 UTC) #2
Felix Dahlke
Wouldn't it be better to handle maxHits etc. being 0 as a special case? Doesn't ...
March 1, 2013, 8:53 a.m. (2013-03-01 08:53:05 UTC) #3
Wladimir Palant
On 2013/03/01 08:53:05, Felix H. Dahlke wrote: > Wouldn't it be better to handle maxHits ...
March 1, 2013, 9:03 a.m. (2013-03-01 09:03:55 UTC) #4
Felix Dahlke
March 1, 2013, 9:07 a.m. (2013-03-01 09:07:21 UTC) #5
On 2013/03/01 09:03:55, Wladimir Palant wrote:
> maxHits and totalHits can only be zero if all the individual hit counts are
zero
> - so the result of the division will still be zero. Handling it this way is
> simpler than adding special cases everywhere that division is made (I actually
> tried that first).

Right, LGTM.

Powered by Google App Engine
This is Rietveld