Yii Framework Forum: Condition With Relations - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Condition With Relations Rate Topic: -----

#1 User is offline   Deram 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 48
  • Joined: 07-June 12

Posted 06 February 2013 - 11:25 AM

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?

EDIT:

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

#2 User is offline   Foghist 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 26
  • Joined: 31-January 13

Posted 06 February 2013 - 01:29 PM

I'd like to know this as well.
0

#3 User is offline   Deram 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 48
  • Joined: 07-June 12

Posted 07 February 2013 - 07:20 AM

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

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users