Condition With Relations

Hey guys, i’m currently building a site in which you can rate certain user-made games. These games exists on different levels, or ‘platforms’ as we call them, but a game can exist on multiple platforms at the same time. The user should be able to give an independent rating for each platform the game is on.

What i’ve come to this far is this:

Game model:

'overallAVG2' => array(self::STAT, 'Rating', 'game_id', 'select' => 'AVG(overall)', 'condition'=>'platform_id=2'),

game view

<?php echo $model->overallAVG; ?>

To save some space, i’ve cut out the other relations overallAVG3, overallAVG4 etc.

What i want to do is to cut out all these relations and just have it in one simple relation, with a variable in the end (instead of 2 or 3 or 4, then writing something like $P_id) and then in the view file determine which platforms the rating should show for and which it shouldn’t.

Can you guys help me do that?


I’m also interested in how to show the result with only one decimal instead of four

I’d like to know this as well.

I’m usually not one for bumping, but i’m stuck on this. Can someone please help?