Skip to content

Instantly share code, notes, and snippets.

@nick1123
Created October 16, 2013 20:00
Show Gist options
  • Save nick1123/7013834 to your computer and use it in GitHub Desktop.
Save nick1123/7013834 to your computer and use it in GitHub Desktop.
tournament matches
# 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