mirror of
https://github.com/jcwimer/wrestlingApp
synced 2026-04-07 23:07:25 +00:00
Use turbo streams for the bout board instead of auto refreshing every 30 seconds.
This commit is contained in:
@@ -9,6 +9,7 @@ class Mat < ApplicationRecord
|
||||
QUEUE_SLOTS = %w[queue1 queue2 queue3 queue4].freeze
|
||||
|
||||
after_save :clear_queue_matches_cache
|
||||
after_commit :broadcast_up_matches_board, on: :update, if: :up_matches_queue_changed?
|
||||
|
||||
def assign_next_match
|
||||
slot = first_empty_queue_slot
|
||||
@@ -276,4 +277,12 @@ class Mat < ApplicationRecord
|
||||
)
|
||||
end
|
||||
|
||||
def broadcast_up_matches_board
|
||||
Tournament.broadcast_up_matches_board(tournament_id)
|
||||
end
|
||||
|
||||
def up_matches_queue_changed?
|
||||
saved_change_to_queue1? || saved_change_to_queue2? || saved_change_to_queue3? || saved_change_to_queue4?
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user