public function getRating() { $query = new RatingQuery(); $query->orderByThreshold("DESC"); $query->limit(1); $query->where("threshold <= " . $this->getScore()); return $query->findOne(); }
public static function getRatingForScore($score) { return RatingQuery::create()->where('Rating.Threshold <= ?', $score)->orderByThreshold("DESC")->findOne(); }
<div class="container"> <div class="col-md-8"> <h1>Rating System</h1> <p>PCMRatings is intended to provide objective scoring of the technical implementation of video games. Rather than rate games based on subjective properties, like artistic quality or "fun", they are marked with specific positive and negative traits.</p> <p>The rating system starts with a score of 0. Individual negative options subtract from that score, while positive options increase the score. The final score is compared against the minimum scores required for each rating to determine which rating a game receives.</p> <h2>Ratings</h2> <?php $ratings = RatingQuery::create()->orderByThreshold("DESC")->find(); ?> <table> <tr> <th colspan="2">Rating</th> <th>Min. Score</th> <th>Comment</th> </tr> <?php foreach ($ratings as $rating) { ?> <tr> <td><img src="img/badges/<?php echo $rating->getInitial(); ?> .jpg" style="height: 50px;"/></td>