-
-
Save ramontayag/667391 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def punch_asshole | |
shots_away = Shot.where("cup != 0 and round_id = ? and team_id = ?", round.id, game.away.id) | |
shots_home = Shot.where("cup != 0 and round_id = ? and team_id = ?", round.id, game.home.id) | |
if shots_away.count == 2 | |
Player.includes(:shots).where("shots.cup == 0 and shots.round_id = ? and shots.team_id = ?", round.id, game.away.id).assholes += 1 | |
end | |
if shots_home.count == 2 | |
Player.includes(:shots).where("shots.cup == 0 and shots.round_id = ? and shots.team_id = ?", round.id, game.home.id).assholes += 1 | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment