Wrong percentage in poll

Author Message

Kristoffer Karlsson

Wednesday 30 May 2007 6:17:49 pm

The percentage calculation in my poll is wrong.

63 votes of 116 is 35%
26 votes of 116 is 15%

Obviously that is not right...

I guess there must be something wrong in the following code. Am I right?

{let percentage = cond( $total_count|gt( 0 ), round( div( mul( $:item_count, 100 ), $total_count ) ), 0 )
                         tenth      = cond( $total_count|gt( 0 ), round( div( mul( $:item_count, 10 ), $total_count ) ), 0 )}

_____________________________________
Blog: http://www.kristofferkarlsson.com
Website: http://www.spelkanalen.com

Kristoffer Karlsson

Thursday 31 May 2007 12:31:33 am

I copied the template from http://svn.ez.no/svn/extensions/ezwebin/trunk/packages/ezwebin_extension/ezextension/ezwebin/design/ezwebin/templates/content/collectedinfo/poll.tpl

...but I still get the same result.

2 votes of 5 = 1%
3 votes of 5 = 2 %

Strange...

Ideas?

_____________________________________
Blog: http://www.kristofferkarlsson.com
Website: http://www.spelkanalen.com

Ɓukasz Serwatka

Thursday 31 May 2007 1:27:03 am

What happen when you clear the view cache? I did quick test and count works correct here.

Personal website -> http://serwatka.net
Blog (about eZ Publish) -> http://serwatka.net/blog

Kristoffer Karlsson

Thursday 31 May 2007 1:05:46 pm

Cleared cache

Still the same result...

_____________________________________
Blog: http://www.kristofferkarlsson.com
Website: http://www.spelkanalen.com

Powered by eZ Publish™ CMS Open Source Web Content Management. Copyright © 1999-2014 eZ Systems AS (except where otherwise noted). All rights reserved.

eZ debug

Timing: Jan 31 2025 03:25:23
Script start
Timing: Jan 31 2025 03:25:23
Module start 'layout'
Timing: Jan 31 2025 03:25:23
Module start 'content'
Timing: Jan 31 2025 03:25:23
Module end 'content'
Timing: Jan 31 2025 03:25:23
Script end

Main resources:

Total runtime0.0299 sec
Peak memory usage6,144.0000 KB
Database Queries3

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0089 588.1563151.2109
Module start 'layout' 0.00890.0053 739.3672220.6875
Module start 'content' 0.01420.0136 960.05471,001.9453
Module end 'content' 0.02780.0020 1,962.000033.9922
Script end 0.0299  1,995.9922 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.003010.0479140.0002
Check MTime0.00124.0276140.0001
Mysql Total
Database connection0.00113.637510.0011
Mysqli_queries0.005919.696130.0020
Looping result0.00000.117310.0000
Template Total0.00165.210.0016
Template load0.00124.159210.0012
Template processing0.00031.067310.0003
Override
Cache load0.00082.793610.0008
General
dbfile0.00123.931180.0001
String conversion0.00000.029540.0000
Note: percentages do not add up to 100% because some accumulators overlap

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 1
 Number of unique templates used: 1

Time used to render debug report: 0.0001 secs