/**
  * Calculates the new rating
  *
  * @param class_module_rating_rate $objSourceRate The rating-record to update
  * @param float $floatNewRating The rating fired by the user
  *
  * @return float the new rating
  */
 public function doRating(class_module_rating_rate $objSourceRate, $floatNewRating)
 {
     //calc the rating's midpoint depending on the maximum rating value
     $floatRatingMidpoint = (class_module_rating_rate::$intMaxRatingValue + 1) / 2;
     $floatAssessedRating = 0;
     if ($floatNewRating == $floatRatingMidpoint) {
         //the rating exactly matches the average rating value
         //it doesn't need to be assessed
         $floatAssessedRating = $floatNewRating;
     } else {
         //determine the interval between assessed ratings
         //the number 0.5 is to the maximum change which is applied to a rating during assessment
         //a more probable rating and a higher number of ratings will make this interval less meaningful
         $floatAssessmentInterval = 0.5 / ($floatRatingMidpoint - 1);
         //calc the assessment on the current rating
         $floatAssessedRating = ($floatRatingMidpoint - $floatNewRating) * $floatAssessmentInterval + $floatNewRating;
         //add or subtract a bonus depending on the number of already existing ratings
         $intAdditionSign = 1;
         if ($floatNewRating < $floatRatingMidpoint) {
             $intAdditionSign = -1;
         }
         $floatAssessedRating = $floatAssessedRating + $intAdditionSign * ($objSourceRate->getIntHits() / class_module_rating_algo_gaussian::$intAssessmentSoftenerFactor * 2);
         //reset the final assessed ratings if they should exceed the user's rating
         //this could only happen with a high number of ratings on an object
         if ($floatNewRating < $floatRatingMidpoint && $floatAssessedRating < $floatNewRating || $floatNewRating > $floatRatingMidpoint && $floatAssessedRating > $floatNewRating) {
             $floatAssessedRating = $floatNewRating;
         }
     }
     //calc the new rating
     $floatNewRating = ($objSourceRate->getFloatRating() * $objSourceRate->getIntHits() + $floatAssessedRating) / ($objSourceRate->getIntHits() + 1);
     return $floatNewRating;
 }
 /**
  * Calculates the new rating
  *
  * @param class_module_rating_rate $objSourceRate The rating-record to update
  * @param float $floatNewRating The rating fired by the user
  *
  * @return float the new rating
  */
 public function doRating(class_module_rating_rate $objSourceRate, $floatNewRating)
 {
     //calc the new rating
     $floatNewRating = ($objSourceRate->getFloatRating() * $objSourceRate->getIntHits() + $floatNewRating) / ($objSourceRate->getIntHits() + 1);
     return $floatNewRating;
 }