1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Fixed Rating average has a ridiculous number of significant figures...

Discussion in 'Resource Manager Resolved Bugs' started by Liam W, Dec 3, 2014.

  1. Liam W

    Liam W Well-Known Member

    And Google is using all of them:

    Screen Shot 2014-12-03 at 22.52.10.png
    Really, I don't think it should go above 2 sig fig... Although three may be deemed acceptable.

    Liam
     
    imthebest likes this.
  2. Chris D

    Chris D XenForo Developer Staff Member

    What exactly is that a screenshot of?
     
  3. batpool52!

    batpool52! Well-Known Member

  4. Jeremy

    Jeremy XenForo Moderator Staff Member

    XenResource_ControllerPublic_Author::actionView()'s $viewParams array contains this line:
    PHP:
        'ratingAvg' => $resourceModel->getRatingAverage(
            
    $aggregate['rating_sum'], $aggregate['rating_count']
        ),
    XenResource_Model_Resource::prepareResource() should contains this line:
    PHP:
    $resource['rating'] = $this->getRatingAverage($resource['rating_sum'], $resource['rating_count']);
    Both do not enable rounding, which is the 3rd parameter to getRatingAverage() (defaults to false).
     
  5. Chris D

    Chris D XenForo Developer Staff Member

    There was a third occurrence of the rating average not rounding, also, that I've fixed. Arguably we could have defaulted that method to round by default, but we'll avoid that in case anyone has extended or used that method in add-ons.

    Fixed thanks :)
     

Share This Page