Created
October 16, 2013 20:00
-
-
Save nick1123/7013834 to your computer and use it in GitHub Desktop.
tournament matches
This file contains hidden or 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
| # Returns an array of matches that occur during the tournament and have a | |
| # game_type of 100 | |
| def matches | |
| values = Match.where(:game_type => ::Match::GAME_TYPE_TRN).where( | |
| "starts_at >= ? and starts_at < ?", self.start_time, self.end_time).order( | |
| "id ASC") | |
| # Limit matches to max rounds | |
| if self.rounds.present? | |
| values = values[0..(self.rounds.to_i - 1)] | |
| end | |
| return values | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment