1
0
mirror of https://github.com/jcwimer/wrestlingApp synced 2026-04-05 06:07:20 +00:00

Use websockets on stats page to determine which match to stat.

This commit is contained in:
2026-02-23 17:56:40 -05:00
parent 654cb84827
commit ca4d5ce0db
11 changed files with 211 additions and 25 deletions

View File

@@ -18,8 +18,19 @@
<div id="cable-status-indicator" data-match-data-target="statusIndicator" class="alert alert-secondary" style="padding: 5px; margin-bottom: 10px; border-radius: 4px;"></div>
<h4>Bout <strong><%= @match.bout_number %></strong></h4>
<% if @show_next_bout_button && @next_match %>
<%= link_to "Skip to Next Match for Mat #{@mat.name}", mat_path(@mat, bout_number: @next_match.bout_number), class: "btn btn-primary" %>
<% if @mat %>
<% queue_matches = @queue_matches || @mat.queue_matches %>
<div style="margin-bottom: 10px;">
<% queue_matches.each_with_index do |queue_match, index| %>
<% queue_label = "Queue #{index + 1}" %>
<% if queue_match %>
<% button_class = queue_match.id == @match.id ? "btn btn-success btn-sm" : "btn btn-primary btn-sm" %>
<%= link_to "#{queue_label}: Bout #{queue_match.bout_number}", mat_path(@mat, bout_number: queue_match.bout_number), class: button_class %>
<% else %>
<button type="button" class="btn btn-default btn-sm" disabled><%= "#{queue_label}: Not assigned" %></button>
<% end %>
<% end %>
</div>
<% end %>
<h4>Bracket Position: <strong><%= @match.bracket_position %></strong></h4>

View File

@@ -1,6 +1,8 @@
<% @mat = mat %>
<% @match = local_assigns[:match] || mat.queue1_match %>
<% @next_match = local_assigns[:next_match] || mat.queue2_match %>
<% @queue_matches = local_assigns[:queue_matches] || mat.queue_matches %>
<% @match = local_assigns[:match] || @queue_matches[0] %>
<% @match ||= @queue_matches[0] %>
<% @next_match = local_assigns[:next_match] || @queue_matches[1] %>
<% @show_next_bout_button = local_assigns.key?(:show_next_bout_button) ? local_assigns[:show_next_bout_button] : true %>
<% @wrestlers = [] %>