One of my nodes has a score of: 86.66670000000001%

Is there a way to get it to give a max of 3 decimals?

CommentFileSizeAuthor
#6 votingapi_round.patch784 bytesScott Reynolds

Comments

drewish’s picture

Status: Active » Postponed (maintainer needs more info)

the how totally depends on where you're seeing it. need more detail.

Flying Drupalist’s picture

Version: 6.x-2.0-rc1 » 6.x-2.0-rc2

I'm seeing this as a views field. Voting API results. Thanks!

Flying Drupalist’s picture

Status: Postponed (maintainer needs more info) » Active
Scott Reynolds’s picture

Should be really easy to achieve. I imagine the handler inherits from views_handler_field_numeric. So all that you need to do is override the options_definition

function options_definition() {
  $options = parent::options_definition();
  $options['float'] = TRUE;
  return $options;
}

That will tell the Views Interface to ask the user how many decimals.

Flying Drupalist’s picture

Thanks Scott Reynolds, where would I put that? Is it a patch?

Scott Reynolds’s picture

StatusFileSize
new784 bytes

sure heres a patch. I don't think its the best way to achieve it but, it works.

Flying Drupalist’s picture

Status: Active » Reviewed & tested by the community

Thanks a lot! Works for me!

eaton’s picture

Status: Reviewed & tested by the community » Fixed

Checked into dev, will be in RC3. Thanks!

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.