Welcome to Geeklog Thursday, October 28 2021 @ 05:04 am EDT

Geeklog Forums

POLLS: How remove ".xx" part?


Status: offline

sorenson2743

Forum User
Newbie
Registered: 16/06/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: 12/01/02
Posts: 13073
Location:Stuttgart, Germany
I guess this is what you want to change (in function COM_pollResults in lib-common.php):
PHP 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: 16/06/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 EDT. The time is now 05:04 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