1
0
mirror of https://github.com/jcwimer/wrestlingApp synced 2026-03-25 01:14:43 +00:00

tournament.total_rounds should return 0 if there are none

This commit is contained in:
2019-01-09 08:27:52 -05:00
parent 5c0c4f8d7b
commit 046b48370e

View File

@@ -46,7 +46,11 @@ class Tournament < ActiveRecord::Base
end end
def total_rounds def total_rounds
self.matches.sort_by{|m| m.round}.last.round if self.matches.count > 0
self.matches.sort_by{|m| m.round}.last.round
else
0
end
end end
def assign_mats(mats_to_assign) def assign_mats(mats_to_assign)