summaryrefslogtreecommitdiff
path: root/app/models/tournament.rb
diff options
context:
space:
mode:
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