Path

ez projects / ezsurvey_ezp4 / forum / general / sum of results is not 100% / re: sum of results is not 100%


Sum of results is not 100%

You need to be logged in to post messages in the forums. New users may register here.

Jean-Luc Nguyen

Member since:
09 January 2008

Posts: 12

Friday 16 September 2011 6:16:07 pm

Hi,

I don't know if somebody has this strange behaviour, but on a only multiple choices survey, the sum of all pourcentages is either 99% or 101%. I guess the pourcentage of each result is incorrectly rounded.

I guess it is managed in: extension/ezsurvey/modules/survey/classes/ezsurveymultiplechoice.php
Up

Jean-Luc Nguyen

Member since:
09 January 2008

Posts: 12

Friday 16 September 2011 6:26:17 pm

OK, solved it, on mentionned file:

extension/ezsurvey/modules/survey/classes/ezsurveymultiplechoice.php

Changed:

-
$percentage = (int) round( ( 100 * $row['count'] ) / $count );

to

+
$percentage = round( ( 100 * $row['count'] ) / $count, 2 );

In order to have pourcentage 100,01, which is better...
Up

Nicolas Pastorino

Member since:
09 January 2008

Posts: 53

Monday 19 September 2011 10:57:53 am

Hi Jean-Luc,

That is a fix you could directly push in the repository, useful one. I warmly invite you to request membership here : http://projects.ez.no/ezsurvey_ezp4/team/members
and then push the fix.

Cheers !

--
Nicolas Pastorino
VP Community - eZ Systems
Member of the Community Project Board

eZ Publish Community on twitter: http://twitter.com/ezcommunity/

t : http://twitter.com/jeanvoye
G+ : http://plus.tl/jeanvoye

Up

You need to be logged in to post messages in the forums. New users may register here.