mirror of
https://github.com/jcwimer/wrestlingApp
synced 2026-03-25 01:14:43 +00:00
Added a sort by bout number for assign_next_match
This commit is contained in:
@@ -21,7 +21,7 @@ class Mat < ActiveRecord::Base
|
||||
end
|
||||
|
||||
def assign_next_match
|
||||
t_matches = tournament.matches.select{|m| m.mat_id == nil && m.finished != 1 && m.bout_number != nil}
|
||||
t_matches = tournament.matches.select{|m| m.mat_id == nil && m.finished != 1 && m.bout_number != nil}.sort_by{|m| m.bout_number}
|
||||
if t_matches.size > 0
|
||||
match = t_matches.sort_by{|m| m.bout_number}.first
|
||||
match.mat_id = self.id
|
||||
|
||||
Reference in New Issue
Block a user