summaryrefslogtreecommitdiff
path: root/app/models/tournament.rb
diff options
context:
space:
mode:
authorguntasgrewal <guntasgrewal@gmail.com>2014-04-07 03:48:51 -0400
committerguntasgrewal <guntasgrewal@gmail.com>2014-04-07 03:48:51 -0400
commitf20dc8df17187027c1881803dbc72b1d3802ff1a (patch)
tree32c71a2fa178d439f9b0720a59287832f3945a6b /app/models/tournament.rb
parent0da3155cc44e257fdcaae81c9dd7f2a38d5389df (diff)
Tournament advancement stuff. IT'S 4 AM
Diffstat (limited to 'app/models/tournament.rb')
-rw-r--r--app/models/tournament.rb10
1 files changed, 10 insertions, 0 deletions
diff --git a/app/models/tournament.rb b/app/models/tournament.rb
index 10d7b30..aa331f0 100644
--- a/app/models/tournament.rb
+++ b/app/models/tournament.rb
@@ -5,6 +5,16 @@ class Tournament < ActiveRecord::Base
has_and_belongs_to_many :players, class_name: "User", association_foreign_key: "player_id", join_table: "players_tournaments"
has_and_belongs_to_many :hosts, class_name: "User", association_foreign_key: "host_id", join_table: "hosts_tournaments"
+ def matches_ordered
+ h = {}
+ i = 1
+ matches.order(:id).each do |m|
+ h[i] = m
+ i += 1
+ end
+ return h
+ end
+
def preferences
@preferences ||= Preferences.new(self)
end