Welcome to Geeklog, Anonymous Saturday, November 30 2024 @ 12:34 am EST

Geeklog Forums

POLLS: How remove ".xx" part?


Status: offline

sorenson2743

Forum User
Newbie
Registered: 06/16/05
Posts: 13
Location:Aylmer, ON Canada
Rather than have each poll answer shown as "xx.yy%"in the block, I would like to remove the ".yy" part and just be left with "xx%". I don't care if the total is +/- 100% because of round ups or round downs.

Is there an easy way to do this? TIA.
 Quote

Status: offline

Dirk

Site Admin
Admin
Registered: 01/12/02
Posts: 13073
Location:Stuttgart, Germany
I guess this is what you want to change (in function COM_pollResults in lib-common.php):
Text Formatted Code
$poll->set_var( 'answer_percent',
                sprintf( '%.2f', $percent * 100 ));
 

bye, Dirk
 Quote

sorenson2743

Anonymous
Thanks, Dirk. That's did the trick.
 Quote

Status: offline

sorenson2743

Forum User
Newbie
Registered: 06/16/05
Posts: 13
Location:Aylmer, ON Canada
Forgot to mention, for other readers, that just replacing the "2" in Dirk's reference with "0" changes it to no decimal points. A "1" would insert one decimal point.
 Quote

All times are EST. The time is now 12:34 am.

  • Normal Topic
  • Sticky Topic
  • Locked Topic
  • New Post
  • Sticky Topic W/ New Post
  • Locked Topic W/ New Post
  •  View Anonymous Posts
  •  Able to post
  •  Filtered HTML Allowed
  •  Censored Content