Closed chcholman closed 12 years ago
Teams get points from the team challenges, which are just assignments for teams. One of those challenges is reading reactions. Each time a student makes it to the semis for reading reactions their team earns 500 points.
Sent from my iPhone
On Jan 28, 2012, at 16:20, Cory Kaufmanreply@reply.github.com wrote:
Team points = sum of reading scores for all students in the team? Or are there other ways teams get points? Do all reading reactions count, or just certain ones?
Reply to this email directly or view it on GitHub: https://github.com/BellotaStudios/Grade-Tracker/issues/28#issuecomment-3703637
Ok so team challenges (that are not reading reactions) should reference the team (belongs_to :team, has_many :assignments)
Then you can do something like this in the Team model:
def score challenge_score = assignments.grades.map(&:score).inject(&:+) reading_reaction_score = 500 * users.grades.reading_reactions.map { |g| 1 if g.semifinalist? }.inject(&:+) challenge_score + reading_reaction_score end
(Off topic: can you look at the ReadingReaction model? I suspect that most of what's in there really belongs to Grade (or a subclass of Grade).
Team points = sum of reading scores for all students in the team? Or are there other ways teams get points? Do all reading reactions count, or just certain ones?