Right now, I have the following:
win_streakcolumn on the
- This method in
win_streak as follows:
- The number if the number games in the streak
- The value (positive or negative) specifies whether those games were wins (positive) or losses (negative)
def adjust_streak u = self.user case self.result when 'Win' u.win_streak > 0 ? u.win_streak += 1 : u.win_streak = 1 when 'Loss' u.win_streak > 0 ? u.win_streak = -1 : u.win_streak -= 1 end u.save end
I'm looking for a cleaner, and more succinct way to do this (e.g. keep track of win/loss streaks).