From 567b8e165554a2abd9ca3fa92eb15d7d133a02bd Mon Sep 17 00:00:00 2001 From: Sebastian Grewe Date: Wed, 14 Aug 2013 11:10:58 +0200 Subject: [PATCH] Fix rounding issues on total row * Use actual percentages to calculate the total to ensure the rows average matches the totals average Fixes #596 --- public/templates/mmcFE/statistics/blocks/default.tpl | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/public/templates/mmcFE/statistics/blocks/default.tpl b/public/templates/mmcFE/statistics/blocks/default.tpl index fb2a799d..87b9ecb5 100644 --- a/public/templates/mmcFE/statistics/blocks/default.tpl +++ b/public/templates/mmcFE/statistics/blocks/default.tpl @@ -47,11 +47,13 @@ target and network difficulty and assuming a zero variance scenario. -{assign var=rank value=1} +{assign var=count value=0} {assign var=totalexpectedshares value=0} {assign var=totalshares value=0} +{assign var=totalpercentage value=0} {section block $BLOCKSFOUND} {assign var="totalshares" value=$totalshares+$BLOCKSFOUND[block].shares} + {assign var="count" value=$count+1} {$BLOCKSFOUND[block].height} @@ -72,6 +74,7 @@ target and network difficulty and assuming a zero variance scenario. {$BLOCKSFOUND[block].shares|number_format} {math assign="percentage" equation="shares / estshares * 100" shares=$BLOCKSFOUND[block].shares estshares=$estshares} + {assign var="totalpercentage" value=$totalpercentage+$percentage} {$percentage|number_format:"2"} @@ -80,8 +83,7 @@ target and network difficulty and assuming a zero variance scenario. Totals {$totalexpectedshares|number_format} {$totalshares|number_format} - {math assign="totalpercentage" equation="shares / estshares * 100" shares=$totalshares estshares=$totalexpectedshares} - {$totalpercentage|number_format:"2"} + {($totalpercentage / $count)|number_format:"2"}