I'm wondering if there's a way in RoR other than going to raw SQL to
take a table of scores, group and sum them by each user, then average
those values?
I'm wondering if there's a way in RoR other than going to raw SQL to
take a table of scores, group and sum them by each user, then average
those values?
I think you can use named_scope for last_week and this_week, and
has_many relationships between user and the gamepoint, so that will
give you user.gamepoints.last_week and user.gamepoints.this_week.
Then you can use collect to get the point values and do the sum and
average.